rpc_url='/rpc/main.app';
coprpc={};
copquery={};
if(window.location.search.substring(1)){
copquery={};
var _p=window.location.search.substring(1).split('&');
for(var i=0;i<_p.length;i++){
var _pv=_p[i].split('=');
if(_pv.length==2){
copquery[_pv[0]]=decodeURIComponent(_pv[1]);
}
}
}
cp = new Ext.state.CookieProvider({
path: "/",
expires: new Date(new Date().getTime()+(1000*60*60*24*30))
});
if(!cp.get('sid')){
cp.set('sid','nosid');
}
// Ext.state.Manager.setProvider(cp);
if((!Ext.isGecko && !Ext.isChrome) || typeof(console)==='null' || typeof(console)==='undefined'){
console={};
console.debug=function(){};
console.log=function(){};
}
console.log= console.log ? console.log : function(){};
console.debug= console.debug ? console.debug : function(){};
var remote_url='';
copdesk = new Ext.app.App({
loader: rpc_url,
//remote: remote_url,
init :function(){
Ext.QuickTips.init();
Ext.apply(Ext.QuickTips.getQuickTip(), {
maxWidth: 400,
minWidth: 100,
dismissDelay: 0
});
},
showError:cop.msg.error,
getModules : function(){
return [ new copdesk.module_users(),new copdesk.module_group(),new copdesk.module_searchMenu(),new copdesk.module_sheet(),new copdesk.module_order(),new copdesk.module_search(),new copdesk.module_widgets(),new copdesk.module_note(),new copdesk.module_maintenance(),new copdesk.module_projectRequest(),new copdesk.module_user(),new copdesk.module_feedback(),new copdesk.module_importNotes(),new copdesk.module_comparison(),new copdesk.module_special_procurement(),new copdesk.module_filter(),new copdesk.module_cloudPlaces(),new copdesk.module_help(),new copdesk.module_configWortmann(),new copdesk.module_configTarox(),new copdesk.module_backup(),new copdesk.module_importVK(),new copdesk.module_editOrderStatus(),new copdesk.module_features(),new copdesk.module_info(),new copdesk.module_projects(),new copdesk.module_configMenu(),new copdesk.module_prodalarm(),new copdesk.module_calc(),new copdesk.module_media(),new copdesk.module_interfaces(),new copdesk.module_log(),new copdesk.module_contactlist(),new copdesk.module_cron(),new copdesk.module_ordercenter(),new copdesk.module_general(),new copdesk.module_orderstatus(),new copdesk.module_configMemSol(),new copdesk.module_export(),new copdesk.module_autotask(),new copdesk.module_support(),new copdesk.module_contact(),new copdesk.module_rmaRequest(),new copdesk.module_promo(),new copdesk.module_supCfg(),new copdesk.module_start(),new copdesk.module_orderlist(),new copdesk.module_equipment(),new copdesk.module_configPrinterCare(),new copdesk.module_notelist() ];
},
getStartConfig : function(){
return {
iconCls: '',
title:'',
toolItems: [
{
text:'Logout ',
iconCls:'icon-logout',
scope:this,
handler: function(){
var mgr = copdesk.desktop.getManager();
mgr.each(function(win){
win.close();
})
coprpc.logout({},{
success:function(){
cp.clear('sid');
window.location.reload();
},
failure:function(){
cp.clear('sid');
window.location.reload();
}
});
}
}
]
};
}
});
copdesk.module_users = Ext.extend(Ext.app.Module, {
moduleId: "module_users",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_group = Ext.extend(Ext.app.Module, {
moduleId: "module_group",
autostart: false,
preload: false,
init: function () {
this.title = cop.lang.title_module_group;
}
});
copdesk.module_searchMenu = Ext.extend(Ext.app.Module, {
moduleId: "module_searchMenu",
autostart: false,
preload: false,
init: function () {
var mi = [
[cop.lang.title_module_article_search, "module_search", "icon-search", false],
[cop.lang.title_module_prodalarm, "module_prodalarm", "icon-alarm", false],
[cop.lang.title_module_features, "module_features", "icon-search-features", true],
[cop.lang.title_module_promo, "module_promo", "icon-search-promo", false],
[cop.lang.title_module_projects, "module_projects", "icon-search-projects", false],
[cop.lang.title_module_special_procurement, "module_special_procurement", "icon-search-special-procurement", false],
[cop.lang.title_module_cloudPlaces, "module_cloudPlaces", "icon-cloud", false]
];
this.launcher = {
text: cop.lang.title_module_search,
iconCls: "icon-search",
scope: this,
menuPos: 10,
menu: {
items: []
}
};
/*
console.debug(coprpc)
coprpc.checkModule({licMod:true,module:{module_id:6000,module_f1:'6004',module_f5:'feat_search'}},function(o,t){
if(o && o.success){
mi[1][2]=false;
}else{
}
})
*/
if ([2, 3, 5, 20, 41, 43, 50, 95, 96, 98].indexOf(user_group) === -1) {
mi.splice(6, 1);
}
if (user_group != 96) {
mi.splice(5, 1);
}
if ([2, 3, 5, 20, 41, 43, 50, 95, 96, 98].indexOf(user_group) === -1) {
mi.splice(3, 1);
}
if (feat_search) {
mi[2][3] = false;
}
/*
for(var item in _c_mods){
if(_c_mods[item].module_id == 6000 && _c_mods[item].module_f1 == '6004' && _c_mods[item].module_f5 == 'feat_search'){
mi[1][3]=false;
}
}
*/
for (var i = 0; i < mi.length; i++) {
this.launcher.menu.items.push({
text: mi[i][0],
moduleId: mi[i][1],
iconCls: mi[i][2],
handler: function (btn, ev, c, d) {
copdesk.createWindow(btn.moduleId);
},
disabled: mi[i][3]
});
}
}
});
copdesk.module_sheet = Ext.extend(Ext.app.Module, {
moduleId: "module_sheet",
autostart: false,
preload: true,
text: "Sheet",
init: function () {}
});
Ext.override(copdesk.module_sheet, {
createWindow: function (url) {
var desktop = this.app.getDesktop();
//var win = desktop.getWindow(this.moduleId);
var win = Ext.getCmp("module_sheet");
var winmedia = Ext.getCmp("module_media");
var mgr;
var _setUrl = function (__url) {
if (__url.indexOf("content.copmedia.de") != -1) {
Ext.getCmp("cmmtext").setVisible(true);
} else {
if (__url.indexOf("ingrammicro") != -1 || __url.indexOf(".eno.") != -1 || __url.indexOf(".jarltech.") != -1) {
window.open(__url, "_blank");
return false;
}
Ext.getCmp("cmmtext").setVisible(false);
}
// console.log('DEBUG');
// debugger;
Ext.getCmp("mm_sheet_Iframe").setUrl(url);
return true;
};
if (winmedia) {
var mgr = winmedia.manager;
}
var sid = cp.get("sid");
if (!(sid && sid != "nosid")) {
return;
}
if (!win) {
win = desktop.createWindow({
id: this.moduleId,
layout: "fit",
title: cop.lang.title_module_datasheet,
width: 900,
minWidth: 900,
height: 600,
scope: this,
iconCls: "icon-html",
manager: mgr,
bodyStyle: "background-color:#ffffff",
items: [
new Ext.ux.IFrameComponent({
id: "mm_sheet_Iframe",
url: "",
title: cop.lang.title_module_datasheet
})
],
fbar: {
buttonAlign: "left",
items: [
/*{
id: 'mm_sheet_btn2',
xtype:'splitbutton',
text:cop.lang.txt_datasheet,
disabled:true
},*/
{ xtype: "tbspacer", width: 50, id: "cmmspacer" },
{
xtype: "tbtext",
id: "cmmtext",
hidden: true,
text: "Sie möchten diese Datenblätter in Ihrem ERP System oder Ihrem WebShop verwenden? – Sprechen Sie uns an!"
},
"->",
{
text: cop.lang.btn_close,
width: 100,
handler: function () {
win.close();
}
}
]
},
listeners: {
beforeclose: function () {},
afterlayout: function () {},
beforestaterestore: function (win, state) {
if (win.minWidth > state.width) {
return false;
}
}
}
});
}
if (_setUrl(url)) {
win.show();
} else {
win.close();
}
}
});
copdesk.module_order = Ext.extend(Ext.app.Module, {
moduleId: "module_order",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_search = Ext.extend(Ext.app.Module, {
moduleId: "module_search",
autostart: false,
preload: false,
init: function () {
/*
this.launcher = {
text: cop.lang.title_module_article_search,
iconCls:'icon-search',
scope: this,
menuPos:1
}*/
}
});
copdesk.module_widgets = Ext.extend(Ext.app.Module, {
moduleId: "module_widgets",
autostart: false,
preload: true,
init: function () {}
});
Ext.override(copdesk.module_widgets, {
createWindow: function () {
var desktop = this.app.getDesktop();
var win = desktop.getWindow(this.moduleId);
var dEl = Ext.get("x-desktop");
var widget = [];
pWidgetDefaults = {
iconCls: "ca-icon",
resizable: true,
closable: false,
draggable: false,
collapsed: true,
frame: true,
collapsible: true,
titleCollapse: true,
style: "margin-bottom:5px",
listeners: {
render: function (p) {
new Ext.Resizable(p.getEl(), {
handles: "s",
pinned: true,
listeners: {
beforeresize: function () {
document.body.style.overflowX = "hidden";
},
resize: function () {
document.body.style.overflowX = "";
}
},
resizeElement: function () {
var box = this.proxy.getBox();
p.updateBox(box);
if (p.layout) {
p.doLayout();
}
return box;
}
});
}
}
};
widget[0] = new Ext.Panel(
Ext.apply(
{},
{
id: "copusers",
scope: this,
title: " Users",
collapsed: false,
height: 150,
width: 250,
html: "",
listeners: {
render: function () {
//this.body.createChild('test');
}
}
},
pWidgetDefaults
)
);
this.storeStats = new Ext.data.ArrayStore({
fields: [{ name: "type" }, { name: "time", type: "date", dateFormat: "time" }, { name: "msg" }]
});
widget[1] = new Ext.Panel(
Ext.apply(
{},
{
id: "copstats",
title: " Status",
height: 200,
width: 250,
layout: "fit",
items: [
new Ext.list.ListView({
hideHeaders: true,
store: this.storeStats,
overClass: "x-copstats-list-over",
columns: [
{
dataIndex: "time",
tpl: '{time:date("H:i:s")}', //cop.util.Format.shorttime,
width: 0.25
},
{
dataIndex: "msg"
}
]
})
]
},
pWidgetDefaults
)
);
widget[2] = new Ext.Panel(
Ext.apply(
{},
{
id: "copnotes",
title: " Notes",
height: 150,
width: 250
},
pWidgetDefaults
)
);
this.widgets = widget;
pWidgets = new Ext.Panel({
width: desktop.getWinWidth(),
height: desktop.getWinHeight(),
renderTo: dEl,
frame: false,
border: false,
bodyStyle: "background:none;padding:10px 0px 10px 0px ; overflow:hidden;",
layout: "table",
items: [
{
border: false,
bodyStyle: "background:none;padding:0px;overflow:hidden",
items: [widget[1]]
}
],
listeners: {
beforerender: function () {
Ext.EventManager.onWindowResize(function () {
this.hide();
this.setSize(desktop.getWinWidth(), desktop.getWinHeight());
this.setSize(this.width, desktop.getWinHeight());
this.show();
}, this);
}
}
});
},
getWidgetbyID: function (widgetName) {
var ws = this.widgets;
if (ws) {
for (var i = 0, len = ws.length; i < len; i++) {
if (ws[i].id == widgetName) {
return ws[i];
}
}
}
},
updateCopStats: function (msg) {
w = this.getWidgetbyID("copstats");
if (w) {
this.storeStats.loadData(msg); //,true);
this.storeStats.sort("time", "DESC");
w.expand();
}
}
//copdesk.getModule('module_widgets').updateCopStats([[1269282597083,'test']]);
});
copdesk.module_note = Ext.extend(Ext.app.Module, {
moduleId: "module_note",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_maintenance = Ext.extend(Ext.app.Module, {
moduleId: "module_maintenance",
autostart: false,
preload: false,
init: function () {
var mi = [
[cop.lang.title_module_users, "module_users", "icon-users"],
[cop.lang.title_module_user, "module_user", "icon-changePass"],
[cop.lang.title_module_cron, "module_cron", "icon-cron"],
[cop.lang.title_module_log, "module_log", "icon-log"],
[cop.lang.title_module_general, "module_general", "icon-settings"],
[cop.lang.title_module_backup, "module_backup", "icon-backup"]
];
this.launcher = {
text: cop.lang.title_module_management,
iconCls: "icon-maintenance",
scope: this,
menuPos: 70,
menu: {
items: []
}
};
for (var i = 0; i < mi.length; i++) {
this.launcher.menu.items.push({
text: mi[i][0],
moduleId: mi[i][1],
iconCls: mi[i][2],
handler: function (btn, ev, c, d) {
copdesk.createWindow(btn.moduleId);
}
});
}
}
});
copdesk.module_projectRequest = Ext.extend(Ext.app.Module, {
moduleId: "module_projectRequest",
autostart: false,
preload: true,
init: function () {}
});
Ext.override(copdesk.module_projectRequest, {
createWindow: function (data) {
data = data || {
note_id: 6
};
var desktop = this.app.getDesktop();
var win = Ext.getCmp(this.moduleId);
var me = this;
if (!win) {
var searchTpl = new Ext.XTemplate(
'',
"{name1} {name2} {name3} {name4}
{street} {zipcode} {city} {country}",
"
"
);
var searchContactsTpl = new Ext.XTemplate(
'',
"{name} - {mail}
({department}) {sup_name}",
"
"
);
var storeNoteItems = new Ext.data.DirectStore({
idProperty: "item_id",
id: "projectRequestItems",
root: "rows",
idIndex: 0,
fields: [
{
name: "item_id",
mapping: "item_id"
},
{
name: "note_id",
mapping: "note_id"
},
{
name: "desc_short",
mapping: "desc_short"
},
"man_aid",
"man_name",
{
name: "item_qty",
mapping: "item_qty"
},
{
name: "item_remarks",
mapping: "item_remarks"
},
{
name: "map_id",
mapping: "map_id"
}
]
});
var storeAddresses = new Ext.data.DirectStore({
directFn: coprpc.getAddresses,
idProperty: "address_id",
id: "addresses",
root: "rows",
idIndex: 0,
fields: [
{
name: "address_id",
mapping: "address_id"
},
{
name: "name1",
mapping: "name1"
},
{
name: "name2",
mapping: "name2"
},
{
name: "name3",
mapping: "name3"
},
{
name: "name4",
mapping: "name4"
},
{
name: "street",
mapping: "street"
},
{
name: "zipcode",
mapping: "zipcode"
},
{
name: "city",
mapping: "city"
},
{
name: "country",
mapping: "country"
}
],
sortInfo: {
field: "name1",
direction: "ASC"
}
});
var storeContacts = new Ext.data.DirectStore({
directFn: coprpc.getConfigSup,
baseParams: {
action: "getContacts"
},
idProperty: "contact_id",
id: "contacts",
root: "rows",
idIndex: 0,
fields: [
{
name: "contact_id",
mapping: "contact_id"
},
{
name: "name",
mapping: "name"
},
{
name: "mail",
mapping: "mail"
},
{
name: "sup_id",
mapping: "sup_id"
},
{
name: "sup_name",
mapping: "sup_name"
},
{
name: "sup_custno",
mapping: "sup_custno"
},
{
name: "department",
mapping: "department"
}
],
sortInfo: {
field: "name",
direction: "ASC"
}
});
var _frmResetAddress = function (aType) {
var frm = Ext.getCmp("frmProjectRequest").getForm();
var r = new RegExp("^address\\$" + aType, "");
frm.items.each(function (f) {
if (r.exec(f.name)) {
f.setValue(null);
f.originalValue = null;
}
});
address = {};
};
var saveAddress = function (aType) {
function _save(a) {
coprpc.setAddresses(
{
aData: [a]
},
{
success: function (t, e) {
var _a = t.addresses[0];
if (_a.address_id) {
frm.findField("address$" + aType + "$address_id").setValue(_a.address_id);
}
Ext.getCmp("btSaveAddressPR").setDisabled(true);
}
}
);
}
var frm = Ext.getCmp("frmProjectRequest").getForm();
var a = {};
var r = new RegExp("^address\\$" + aType, "");
frm.items.each(function (f) {
if (r.exec(f.name)) {
a[f.name.replace("address$" + aType + "$", "")] = f.getValue();
}
});
if (a.address_id) {
cop.msg.confirmex(
"Adressdatensatz speichern ",
"Änderungen an aktuellem Datensatz speichern oder neuen Datensatz anlegen?",
function (mb, mt) {
if (mb.id == "save_new") {
a.address_id = 0;
_save(a);
} else if (mb.id == "save") {
_save(a);
}
},
[
{
id: "save_new",
text: cop.lang.btn_save_new
},
{
id: "save",
text: cop.lang.btn_save
},
{
id: "cancel",
text: cop.lang.btn_cancel
}
]
);
} else {
_save(a);
}
};
var cbSearch = Ext.extend(Ext.form.ComboBox, {
store: storeAddresses,
hideTrigger: true,
pageSize: 0,
minChars: 2,
typeAhead: false,
tpl: searchTpl,
itemSelector: "div.ca-search-item",
listeners: {
beforequery: function (qe) {
var _cb = qe.combo;
var aType = _cb.name.split("$")[1];
var frm = Ext.getCmp("frmProjectRequest").getForm();
var _o = {};
var r = new RegExp("address\\$" + aType + "\\$(name|street|zipcode|city|country|contact|phone|fax|email)", "");
frm.items.each(function (f) {
if (r.exec(f.name)) {
var _v = f.getValue();
if (_v) {
_o[f.name] = _v;
}
}
});
_cb.store.baseParams.live_search = _o;
if (aType == "shipping") {
Ext.getCmp("btSaveAddressPR").setDisabled(false);
} else {
Ext.getCmp("btSaveAddressPR").setDisabled(false);
}
},
select: function (cb, rec, idx) {
var frm = Ext.getCmp("frmProjectRequest").getForm();
var _os = rec.json;
var _od = {};
var aType = cb.name.split("$")[1];
for (var _f in _os) {
_od["address$" + aType + "$" + _f] = _os[_f];
}
_frmResetAddress(aType);
frm.setValues(_od);
address = _od;
if (aType == "shipping") {
Ext.getCmp("btSaveAddressPR").setDisabled(true);
} else {
Ext.getCmp("btSaveAddressPR").setDisabled(true);
}
}
}
});
var cbSearchContacts = Ext.extend(Ext.form.ComboBox, {
store: storeContacts,
hideTrigger: true,
pageSize: 0,
minChars: 2,
typeAhead: false,
tpl: searchContactsTpl,
itemSelector: "div.ca-search-item",
listeners: {
beforequery: function (qe) {
var _cb = qe.combo;
var aType = _cb.name.split("$")[1];
var frm = Ext.getCmp("frmProjectRequest").getForm();
var _o = {};
var r = new RegExp("address\\$" + aType + "\\$(name|street|zipcode|city|country|contact|phone|fax|email)", "");
frm.items.each(function (f) {
if (r.exec(f.name)) {
var _v = f.getValue();
if (_v) {
_o[f.name] = _v;
}
}
});
_cb.store.baseParams.live_search = _o;
},
select: function (cb, rec, idx) {
var frm = Ext.getCmp("frmProjectRequest").getForm();
var _os = rec.json;
var _od = {};
var aType = cb.name.split("$")[1];
for (var _f in _os) {
_od["project_" + _f] = _os[_f];
}
frm.setValues(_od);
}
}
});
var gridNoteItems = new Ext.grid.GridPanel({
region: "south",
height: user_group != 96 ? 330 : 230,
// height: 230,
maxHeight: user_group != 96 ? 330 : 230,
// maxHeight: 230,
split: true,
border: true,
frame: true,
padding: 0,
autoExpandColumn: "name",
store: storeNoteItems,
cm: new Ext.grid.ColumnModel({
defaults: {
sortable: false
},
columns: [
{
header: "Map ID",
width: 80,
dataIndex: "map_id"
},
{
header: "HstArtNo",
width: 80,
dataIndex: "man_aid"
},
{
header: "Hersteller",
width: 80,
dataIndex: "man_name"
},
{
header: "Bezeichnung",
width: 130,
renderer: cop.util.Format.qtip,
dataIndex: "desc_short",
id: "name"
},
{
header: "Menge",
width: 45,
align: "center",
dataIndex: "item_qty"
}
]
})
});
var pDates = {
layout: "form",
frame: "true",
title: "Terminierung",
style: "margin-right:3px",
// padding: 3,
items: [
{
name: "date_til",
xtype: "datefield",
anchor: "100%",
format: "d.m.Y",
fieldLabel: "Angebot bis"
},
{
name: "date_decision",
xtype: "datefield",
anchor: "100%",
fieldLabel: "Termin"
},
{
name: "date_ship",
xtype: "datefield",
anchor: "100%",
fieldLabel: "Liefertermin"
}
]
};
var pContact = {
layout: "form",
frame: "true",
title: "Kontaktdaten",
items: [
{
name: "contact$name",
xtype: "textfield",
anchor: "100%",
allowBlank: false,
fieldLabel: "Ansprechpartner"
},
{
name: "contact$phone",
xtype: "textfield",
anchor: "100%",
fieldLabel: "Telefonnummer"
},
{
name: "contact$email",
xtype: "textfield",
anchor: "100%",
allowBlank: false,
fieldLabel: "Mailadresse"
}
]
};
var pEnduser = {
frame: true,
// padding :3,
layout: "column",
defaults: {
columnWidth: 0.5,
labelWidth: 120
},
// collapsed: true,
// style: 'margin-top:3px',
title: "Endkundendaten",
items: [
{
layout: "form",
style: "margin-right:3px",
defaults: {
anchor: "98%",
xtype: "textfield"
},
items: [
{
xtype: "hidden",
name: "address$enduser$address_id"
},
new cbSearch({
name: "address$enduser$name1",
fieldLabel: "Name 1"
}),
new cbSearch({
name: "address$enduser$name2",
fieldLabel: "Name 2"
}),
new cbSearch({
name: "address$enduser$name3",
fieldLabel: "Name 3"
}),
new cbSearch({
name: "address$enduser$name4",
fieldLabel: "Name 4"
}),
new cbSearch({
name: "address$enduser$street",
fieldLabel: "Strasse"
}),
new cbSearch({
name: "address$enduser$zipcode",
fieldLabel: "PLZ"
}),
new cbSearch({
name: "address$enduser$city",
fieldLabel: "Stadt"
})
]
},
{
layout: "form",
defaults: {
anchor: "100%",
xtype: "textfield"
},
items: [
{
name: "address$enduser$country",
fieldLabel: "Land",
xtype: "combo",
typeAhead: true,
triggerAction: "all",
lazyRender: true,
mode: "local",
editable: false,
forceSelection: true,
store: new Ext.data.ArrayStore({
id: 0,
fields: ["country_name", "country"],
data: [
["Deutschland", "DE"],
["Schweiz", "CH"],
["Österreich", "AT"],
["Frankreich", "FR"],
["Spanien", "ES"],
["Niederlande", "NL"],
["Belgien", "BE"],
["Luxemburg", "LU"]
],
sortInfo: {
field: "country_name",
direction: "ASC"
}
}),
displayField: "country_name",
valueField: "country",
listeners: {
select: function () {
Ext.getCmp("btSaveAddressPR").setDisabled(false);
}
}
},
new cbSearch({
name: "address$enduser$contact",
// allowBlank: false,
fieldLabel: "Ansprechpartner"
}),
new cbSearch({
name: "address$enduser$phone",
fieldLabel: "Telefon"
}),
new cbSearch({
name: "address$enduser$fax",
fieldLabel: "Fax"
}),
new cbSearch({
name: "address$enduser$email",
fieldLabel: "Email"
}),
{
name: "address$enduser$type",
fieldLabel: "Art des Endkunden",
xtype: "combo",
typeAhead: true,
triggerAction: "all",
lazyRender: true,
mode: "local",
editable: false,
forceSelection: true,
store: new Ext.data.ArrayStore({
id: 0,
fields: ["type_name", "type"],
data: [
["keine Angabe", "keine Angabe"],
["Öffentlicher Auftraggeber", "Öffentlicher Auftraggeber"],
["Industriekunde / Dienstleister", "Industriekunde / Dienstleister"],
["Sonstiger Auftraggeber / Privatkunde", "Sonstiger Auftraggeber / Privatkunde"]
]
}),
displayField: "type_name",
valueField: "type"
}
]
}
],
fbar: [
{
text: "Speichern",
id: "btSaveAddressPR",
handler: function () {
saveAddress("enduser");
}
},
{
text: "Zurücksetzen",
handler: function () {
_frmResetAddress("enduser");
}
}
]
};
var pProjectInfo = {
layout: "form",
frame: "true",
style: "margin-top:3px",
title: "zusätzliche Informationen",
labelWidth: 150,
// padding: 3,
items: [
new cbSearchContacts({
name: "project_name",
anchor: "100%",
fieldLabel: "Ansprechpartner"
}),
{
xtype: "textfield",
name: "project_custno",
anchor: "100%",
fieldLabel: "Kundennummer"
},
{
xtype: "textfield",
name: "project_mail",
anchor: "100%",
fieldLabel: "An eMail",
allowBlank: false
},
{
xtype: "textfield",
name: "project_salutation",
anchor: "100%",
fieldLabel: "Anrede",
value: "Sehr geehrte Damen und Herren,"
},
{
xtype: "textarea",
name: "project_desc",
anchor: "100%",
fieldLabel: "Beschreibung"
},
{
name: "queriedAt",
xtype: "textfield",
anchor: "100%",
fieldLabel: "angefragt bei",
hidden: user_group != 96
},
{
name: "isCustomer",
xtype: "checkbox",
anchor: "100%",
fieldLabel: "ist Kunde",
hidden: user_group != 96
},
{
name: "buyingBehavior",
xtype: "textfield",
anchor: "100%",
fieldLabel: "Kaufverhalten",
hidden: user_group != 96
},
{
name: "competitor",
xtype: "textfield",
anchor: "100%",
fieldLabel: "Mitbewerber",
hidden: user_group != 96
},
{
name: "partnerstatus",
xtype: "textfield",
anchor: "100%",
fieldLabel: "Hersteller Partnerstatus"
}
]
};
var tp = new Ext.TabPanel({
activeTab: 0,
border: false,
// deferredRender: false,
// items : [{title: 'Allgemein',html: 'A simple tab'}]
items: [
{
title: "Allgemein",
border: false,
frame: true,
items: [
{
layout: "column",
border: false,
defaults: {
columnWidth: 0.5,
labelWidth: 120
},
items: [pDates, pContact]
},
pProjectInfo
]
},
pEnduser
]
});
var fp = new Ext.FormPanel({
region: "center",
id: "frmProjectRequest",
layout: "fit",
items: [tp]
});
win = desktop.createWindow({
xtype: "window",
id: this.moduleId,
width: 800,
height: 760,
border: false,
resizeable: false,
stateful: false,
cls: "x-tools-std",
iconCls: "icon-projectRequest",
title: "Projektanfrage",
layout: "border",
items: [fp, gridNoteItems],
fbar: {
buttonAlign: "left",
defaults: {
width: 100
},
items: [
{
text: "Senden",
handler: function () {
var frm = Ext.getCmp("frmProjectRequest").getForm();
if (frm.isValid()) {
Ext.MessageBox.show({
title: "Sende",
msg: "
Projektanfrage wird übermittelt, bitte warten ...
",
width: 300,
wait: true,
waitConfig: {
interval: 200
}
});
var data = Ext.StoreMgr.get("projectRequestItems").getRange();
var items = [];
for (var i = 0; i < data.length; i++) {
items.push(data[i].json);
}
coprpc.sendProjectRequest(
{
data: frm.getFieldValues(),
items: items
},
{
success: function (t, e) {
Ext.MessageBox.hide();
win.close();
},
failure: function (t, e) {
Ext.MessageBox.hide();
cop.msg.error(e.error);
}
}
);
}
}
},
"->",
{
text: cop.lang.btn_cancel,
handler: function () {
win.close();
}
}
]
}
});
}
this.loadData(data.note_id);
win.show();
},
loadData: function (note_id) {
// console.log('load Project Request Data');
coprpc.getNotes(
{
oData: {
note_id: note_id,
isProjectRequest: true
}
},
{
success: function (t, e) {
var frm = Ext.getCmp("frmProjectRequest").getForm();
var o = {};
note = t.rows[0];
delete note.info;
obj2flat(note, "", o);
// JSONdecodeDate(o);
// console.log(o);
frm.setValues(o);
// loadNoteItems(note.note_id);
}
}
);
coprpc.getNoteItems(
{
oData: {
note_id: note_id,
checkmode: 1
}
},
{
success: function (t, e) {
var store = Ext.StoreMgr.get("projectRequestItems");
store.loadData(t);
}
}
);
}
});
copdesk.module_user = Ext.extend(Ext.app.Module, {
moduleId: "module_user",
autostart: false,
preload: true,
init: function () {}
});
Ext.override(copdesk.module_user, {
createWindow: function () {
var sid = cp.get("sid");
if (!(sid && sid != "nosid")) {
return;
}
var desktop = this.app.getDesktop();
var win = desktop.getWindow(this.moduleId);
if (!win) {
var fn_change = function (_field, _newVal, _oldVal) {
var frm = Ext.getCmp("frm_user").getForm();
var o = {};
flat2obj(frm.getFieldValues(), o);
coprpc.setCurrentUser(
{
uData: o
},
{
failure: function (_conn, response, _options) {
cop.msg.error(response.error || response);
}
}
);
};
win = desktop.createWindow({
id: this.moduleId,
iconCls: "icon-users",
minimizable: false,
maximizable: false,
resizable: true,
border: false,
title: cop.lang.title_module_user,
width: 500,
height: 380,
autoScroll: true,
stateful: false,
items: [
new Ext.FormPanel({
id: "frm_user",
border: false,
frame: false,
layout: "fit",
items: [
{
xtype: "panel",
deferredRender: false,
activeTab: 0,
border: false,
items: [
{
title: "Benutzerdaten",
xtype: "panel",
frame: true,
defaults: {
anchor: "100%",
listeners: {
change: fn_change
}
},
defaultType: "textfield",
layout: "form",
items: [
{
fieldLabel: "ID",
name: "user_id",
disabled: true
},
{
fieldLabel: cop.lang.user_login,
name: "user_login",
disabled: true
},
{
fieldLabel: cop.lang.user_name,
name: "user_data$user_name"
},
{
fieldLabel: cop.lang.user_mail,
name: "user_email"
},
{
fieldLabel: cop.lang.user_tel,
name: "user_data$user_phone"
},
{
xtype: "button",
margins: "0 0 0 5",
text: cop.lang.change_pass,
handler: function () {
setPassword();
}
}
]
},
{
title: "Tarox CSP Portal",
xtype: "panel",
layout: "form",
frame: true,
defaults: {
anchor: "100%",
listeners: {
change: fn_change
}
},
defaultType: "textfield",
items: [
{
fieldLabel: "Single Sign On Token",
name: "user_data$user_tarox_sso"
},
{
xtype: "panel",
html: '
SSO Token das zum Login genutzt wird
'
}
]
},
{
title: "weclapp",
xtype: "panel",
layout: "form",
frame: true,
hidden: !isWeClappUser,
defaults: {
anchor: "100%",
listeners: {
change: fn_change
}
},
defaultType: "textfield",
items: [
{
fieldLabel: "Persönliches API Token",
name: "user_data$user_weclapp_api"
},
{
xtype: "panel",
html: 'Api Token das bei der Übertragung von diesem Nutzer genutzt wird
'
}
]
},
{
title: "autotask",
xtype: "panel",
layout: "form",
frame: true,
hidden: !isAutotaskUser,
defaults: {
anchor: "100%",
listeners: {
change: fn_change
}
},
defaultType: "textfield",
items: [
{
fieldLabel: "Mitarbeiter ID",
name: "user_data$user_autotask_id"
},
{
xtype: "panel",
html: 'ID des Autotasknutzers, der zur Erstellung der Angebote genutzt wird
'
}
]
}
]
}
]
})
],
fbar: {
buttonAlign: "left",
defaults: {
width: 100
},
items: [
"->",
{
xtype: "button",
text: cop.lang.btn_close,
handler: function () {
fn_change();
win.close();
},
scope: this
}
]
}
});
var setPassword = function () {
cop.msg.password("Eingabe neues Passwort", "", function (btn, text) {
if (btn == "ok") {
coprpc.setPass({ pass: b64_sha1(text) });
}
});
};
coprpc.getCurrentUser(
{},
{
success: function (r, _o) {
var data = {};
obj2flat(r, "", data);
var frm = Ext.getCmp("frm_user").getForm();
frm.setValues(data);
}.createDelegate(win)
}
);
}
win.show();
}
});
copdesk.module_feedback = Ext.extend(Ext.app.Module, {
moduleId: "module_feedback",
autostart: false,
preload: true,
init: function () {}
});
Ext.override(copdesk.module_feedback, {
createWindow: function (data) {
data = data || {};
var desktop = this.app.getDesktop();
var win = Ext.getCmp(this.moduleId);
var sid = cp.get("sid");
if (!(sid && sid != "nosid")) {
return;
}
if (!win) {
init = function () {
fItems = data.records;
var _records = [];
var _s = storeFeedbackItems;
Ext.each(fItems, function (item) {
storeFeedbackItems.add(new storeFeedbackItems.recordType(item));
});
coprpc.sendFeedback(
{
load_userdata: true
},
{
success: function (t, e) {
var frm = Ext.getCmp("frmFeedback").getForm();
var o = {};
obj2flat(t, "", o);
frm.setValues(o);
},
failure: function (t, e) {}
}
);
};
var storeFeedbackItems = new Ext.data.DirectStore({
idProperty: "map_id",
id: "feedbackItems",
root: "rows",
idIndex: 0,
fields: ["map_id", "man_name", "man_aid", "ean", "desc_short"]
});
var gridFeedbackItems = new Ext.grid.GridPanel({
region: "center",
height: 230,
//maxHeight: 230,
border: true,
frame: true,
padding: 0,
autoExpandColumn: "name",
store: storeFeedbackItems,
cm: new Ext.grid.ColumnModel({
defaults: {
sortable: true
},
columns: [
{
header: "Map ID",
width: 80,
dataIndex: "map_id"
},
{
header: "HstArtNo",
width: 90,
renderer: cop.util.Format.qtip,
dataIndex: "man_aid"
},
{
header: "Hersteller",
width: 90,
renderer: cop.util.Format.qtip,
dataIndex: "man_name"
},
{
header: "EAN",
width: 90,
renderer: cop.util.Format.qtip,
dataIndex: "ean"
},
{
header: "Bezeichnung",
width: 130,
renderer: cop.util.Format.qtip,
dataIndex: "desc_short",
id: "name"
}
]
})
});
var pContact = {
layout: "form",
frame: "true",
title: "Kontaktdaten",
labelWidth: 150,
items: [
{
name: "contact$name",
xtype: "textfield",
anchor: "100%",
allowBlank: false,
fieldLabel: "Ansprechpartner"
},
{
name: "contact$phone",
xtype: "textfield",
anchor: "100%",
fieldLabel: "Telefonnummer"
},
{
name: "contact$email",
xtype: "textfield",
anchor: "100%",
allowBlank: false,
vtype: "email",
fieldLabel: "Mailadresse"
}
]
};
var pFeedbackInfo = {
layout: "form",
frame: "true",
title: "Informationen",
labelWidth: 150,
style: "margin-top:5px",
items: [
{
xtype: "combo",
editable: false,
forceSelection: true,
displayField: "area_name",
valueField: "area_name",
typeAhead: true,
triggerAction: "all",
//value:0,
stateful: true,
mode: "local",
lazyRender: true,
name: "feedback_area",
anchor: "100%",
fieldLabel: "Bereich",
store: new Ext.data.ArrayStore({
fields: ["area_name"],
data: [["Beschreibung"], ["Datenblatt/Bild"], ["Mapping"], ["Produktgruppe"]]
})
},
{
xtype: "textarea",
name: "feedback_desc",
anchor: "100%",
height: 150,
fieldLabel: "Beschreibung"
}
]
};
var fp = new Ext.FormPanel({
region: "north",
id: "frmFeedback",
layout: "fit",
height: 350,
border: false,
split: true,
items: [
{
xtype: "panel",
frame: true,
layout: "anchor",
//padding:3,
items: [pContact, pFeedbackInfo]
}
]
});
win = desktop.createWindow({
xtype: "window",
id: this.moduleId,
width: 800,
height: 650,
border: false,
resizeable: false,
stateful: false,
cls: "x-tools-std",
iconCls: "icon-proposal",
title: "Feedback",
layout: "border",
items: [fp, gridFeedbackItems],
listeners: {
afterrender: function () {
init();
},
show: function () {},
close: function (p) {}
},
fbar: {
buttonAlign: "left",
defaults: {
width: 100
},
items: [
{
text: "Senden",
handler: function () {
var frm = Ext.getCmp("frmFeedback").getForm();
if (frm.isValid()) {
Ext.MessageBox.show({
title: "Sende",
msg: "
Feedback wird übermittelt, bitte warten ...
",
width: 300,
wait: true,
waitConfig: {
interval: 200
}
});
var data = storeFeedbackItems.getRange();
var items = [];
for (var i = 0; i < data.length; i++) {
items.push(data[i].data);
}
coprpc.sendFeedback(
{
data: frm.getFieldValues(),
items: items
},
{
success: function (t, e) {
Ext.MessageBox.hide();
win.close();
},
failure: function (t, e) {
Ext.MessageBox.hide();
cop.msg.error(e.error);
}
}
);
}
}
},
"->",
{
text: cop.lang.btn_cancel,
handler: function () {
win.close();
}
}
]
}
});
} else {
fItems = data.records;
var _records = [];
var _store = Ext.StoreMgr.get("feedbackItems");
Ext.each(fItems, function (item) {
if (_store.find("map_id", item.map_id) == -1) {
_store.add(new _store.recordType(item));
}
});
}
win.show();
}
});
copdesk.module_importNotes = Ext.extend(Ext.app.Module, {
moduleId: "module_importNotes",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_comparison = Ext.extend(Ext.app.Module, {
moduleId: "module_comparison",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_special_procurement = Ext.extend(Ext.app.Module, {
moduleId: "module_special_procurement",
autostart: false,
preload: true,
init: function () {}
});
Ext.override(copdesk.module_special_procurement, {
createWindow: function () {
var desktop = this.app.getDesktop();
var win = desktop.getWindow(this.moduleId);
var mod = copdesk.getModule("module_special_procurement");
if (!win) {
var frame = new Ext.ux.IFrameComponent({
id: "module_special_procurement_frame",
name: "module_special_procurement_frame",
url: "https://www.comteam.de/tradersguide-kl/"
});
win = desktop.createWindow({
id: this.moduleId,
iconCls: "icon-search-special-procurement",
title: cop.lang.title_module_special_procurement,
layout: "fit",
width: 780,
height: 640,
items: [frame]
});
}
win.show();
}
});
copdesk.module_filter = Ext.extend(Ext.app.Module, {
moduleId: "module_filter",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_cloudPlaces = Ext.extend(Ext.app.Module, {
moduleId: "module_cloudPlaces",
autostart: false,
preload: true,
init: function () {}
});
Ext.override(copdesk.module_cloudPlaces, {
createWindow: function () {
var sid = cp.get("sid");
if (!(sid && sid != "nosid")) {
return;
}
var desktop = this.app.getDesktop();
var win = desktop.getWindow(this.moduleId);
var waitCfg = {
title: "Token wird generiert",
msg: "
Token für Login wird generiert...
",
width: 350,
wait: true,
waitConfig: { interval: 200 }
};
if (!win) {
var tpl = new Ext.XTemplate(
'',
'',
"
",
'',
"",
'
',
'
',
"
",
"
",
"",
"",
'
{desc}
',
"
",
"",
''
);
var store = new Ext.data.DirectStore({
directFn: coprpc.getLists,
baseParams: {
type: "cloud"
},
reader: new Ext.data.JsonReader({
root: "cloud_places",
idProperty: "sup_id",
fields: ["sup_id", "name", "url", "logo", "desc", "action"]
}),
id: "store_cloudPlaces",
autoLoad: true
});
win = desktop.createWindow({
id: this.moduleId,
iconCls: "icon-cloud",
minimizable: false,
maximizable: false,
resizable: false,
title: cop.lang.title_module_cloudPlaces,
stateful: false,
width: 680,
height: 650,
layout: "fit",
items: {
xtype: "panel",
autoScroll: true,
items: [
new Ext.DataView({
store: store,
tpl: tpl,
autoHeight: true,
overClass: "x-view-over",
itemSelector: "div.thumb-wrap",
listeners: {
click: {
fn: function (DataView, index, node, e) {
var rec = DataView.getRecord(node);
if (rec.get("action")) Ext.MessageBox.show(waitCfg);
coprpc.getLists(
{
type: "cloudLink",
sup_id: rec.get("sup_id"),
action: rec.get("action")
},
function (res, err) {
Ext.MessageBox.hide(waitCfg);
if (res && res.link) {
window.open(res.link, "_blank");
}
}
);
}
}
}
})
]
},
fbar: {
defaults: {
width: 100
},
items: [
{
xtype: "button",
text: cop.lang.btn_close,
handler: function () {
win.close();
},
scope: this
}
]
}
});
}
win.show();
}
});
copdesk.module_help = Ext.extend(Ext.app.Module, {
moduleId: "module_help",
autostart: false,
preload: false,
init: function () {
this.launcher = {
text: cop.lang.title_module_help,
iconCls: "icon-help",
scope: this,
menuPos: 80,
menu: {
items: [
{
text: cop.lang.title_module_help_manual,
iconCls: "icon-help-manual",
handler: function () {
coprpc.getInfo(
{},
{
success: function (t, e) {
if (t.info.licensegroup == 95 || t.info.licensegroup == 98) {
var pageURL = "https://neos.supplierdata.de/~neos_docs/Anwenderhandbuch.pdf";
} else if (t.info.licensegroup == 96) {
var pageURL = "https://tgpro.supplierdata.de/docs/Anwenderhandbuch.pdf";
} else {
var pageURL = "https://copwiki.de/mediawiki/index.php?title=Hauptseite";
}
var title = window.title;
var w = screen.width * 0.8;
var h = screen.height * 0.8;
var left = screen.width / 2 - w / 2;
var top = screen.height / 2 - h / 2;
var targetWin = window.open(
pageURL,
title,
"toolbar=yes, location=yes, directories=yes, status=yes, menubar=yes, scrollbars=yes, resizable=yes, copyhistory=yes, width=" +
w +
", height=" +
h +
", top=" +
top +
", left=" +
left
);
}
}
);
}
},
{
text: cop.lang.title_module_help_suppliers,
iconCls: "icon-help-suppliers",
handler: function () {
coprpc.getInfo(
{},
{
success: function (t, e) {
if (t.info.licensegroup == 98) {
var pageURL = "https://neos.supplierdata.de/~neos_docs/Zugangsdaten.pdf";
} else if (t.info.licensegroup == 95) {
var pageURL = "https://neos.supplierdata.de/~neos_docs/Soennecken_Zugangsdaten.pdf";
} else if (t.info.licensegroup == 96) {
var pageURL = "https://tgpro.supplierdata.de/docs/Lieferanteneinstellungen.pdf";
} else {
var pageURL = "https://copwiki.de/mediawiki/index.php?title=Lieferanten_/_Zugangsdaten";
}
var title = window.title;
var w = screen.width * 0.8;
var h = screen.height * 0.8;
var left = screen.width / 2 - w / 2;
var top = screen.height / 2 - h / 2;
var targetWin = window.open(
pageURL,
title,
"toolbar=yes, location=yes, directories=yes, status=yes, menubar=yes, scrollbars=yes, resizable=yes, copyhistory=yes, width=" +
w +
", height=" +
h +
", top=" +
top +
", left=" +
left
);
}
}
);
}
},
{
text: cop.lang.title_module_support,
moduleId: "module_support",
iconCls: "icon-support",
handler: function (btn, ev, c, d) {
coprpc.getInfo(
{},
{
success: function (t, e) {
if (t.info.licensegroup == 95 || t.info.licensegroup == 98) {
parent.location = "mailto:neos-support@nordanex.de";
} else if (t.info.licensegroup == 96) {
parent.location = "mailto:comteam@cop-software.de";
} else {
copdesk.createWindow(btn.moduleId);
}
}
}
);
}
}
]
}
};
var mi = [[cop.lang.title_module_info, "module_info", "icon-module-info"]];
for (var i = 0; i < mi.length; i++) {
this.launcher.menu.items.push({
text: mi[i][0],
moduleId: mi[i][1],
iconCls: mi[i][2],
handler: function (btn, ev, c, d) {
copdesk.createWindow(btn.moduleId);
}
});
}
}
});
copdesk.module_configWortmann = Ext.extend(Ext.app.Module, {
moduleId: "module_configWortmann",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_configTarox = Ext.extend(Ext.app.Module, {
moduleId: "module_configTarox",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_backup = Ext.extend(Ext.app.Module, {
moduleId: "module_backup",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_importVK = Ext.extend(Ext.app.Module, {
moduleId: "module_importVK",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_editOrderStatus = Ext.extend(Ext.app.Module, {
moduleId: "module_editOrderStatus",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_features = Ext.extend(Ext.app.Module, {
moduleId: "module_features",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_info = Ext.extend(Ext.app.Module, {
moduleId: "module_info",
autostart: false,
preload: true,
init: function () {}
});
Ext.override(copdesk.module_info, {
createWindow: function () {
var desktop = this.app.getDesktop();
var win = desktop.getWindow(this.moduleId);
if (!win) {
win = desktop.createWindow({
id: this.moduleId,
iconCls: "icon-module-info",
minimizable: false,
maximizable: false,
resizable: false,
title: cop.lang.title_module_info,
width: 480,
height: 380,
layout: "fit",
tpl: new Ext.XTemplate([
'',
"
",
'',
'
Dieses Produkt ist lizenziert für:',
'
{licensename}',
"
",
"
",
'
',
'
Kundengruppe',
"
",
'
{licensegroup}', //{[cop.lang.list_groups[values.licensegroup]]}',
"
",
"
",
'
',
'
Programmversion',
"
",
'
{version}',
"
",
"
",
'
',
'
Letztes Daten Update',
"
",
'
{[fm.date(new Date(values.last_update),"d.m.Y - H:i")]}',
"
",
"
",
'
',
'
Letztes Software Update',
"
",
'
{[fm.date(new Date(values.last_update_software),"d.m.Y - H:i")]}',
"
",
"
",
'
',
'
Achtung:',
"
Die Software und das Markenzeichen cop sind urheberrechtlich geschützt.
Unbefugte Vervielfältigung oder unbefugter Vertrieb dieser Software oder eines Teils davon sind strafbar. Dies wird sowohl straf- als auch zivilrechtlich verfolgt und kann schwere Strafen und Schadenersatzforderungen zur Folge haben.",
"
",
'
Copyright © 2021 ITscope GmbH',
"
",
"
"
]),
fbar: {
buttonAlign: "left",
defaults: {
width: 100
},
items: [
{
xtype: "button",
text: cop.lang.txt_license,
handler: function () {
if (win.gid == 98) {
window.open("https://neos.supplierdata.de/~neos_docs/NEOS_Nutzungsbedingungen.pdf");
} else if (win.gid == 95) {
window.open("https://neos.supplierdata.de/~neos_docs/SOENNECKEN_Nutzungsbedingungen.pdf");
} else if (win.gid == 96) {
window.open("https://tgpro.supplierdata.de/docs/Nutzungsbedingungen.pdf");
} else {
window.open("https://www.cop-software.de/download/AGB.pdf");
}
},
scope: win
},
{
xtype: "button",
text: "Lizenz ändern",
handler: function () {
cop.msg.license("Lizenz ändern", "", function () {
coprpc.getInfo(
{},
{
success: function (r, o) {
this.update(r.info);
}.createDelegate(win)
}
);
});
},
scope: this
},
"->",
{
xtype: "button",
text: cop.lang.btn_close,
handler: function () {
win.close();
},
scope: this
}
]
}
});
coprpc.getInfo(
{},
{
success: function (r, o) {
this.update(r.info);
this.gid = r.info.licensegroup;
}.createDelegate(win)
}
);
}
win.show();
}
});
copdesk.module_projects = Ext.extend(Ext.app.Module, {
moduleId: "module_projects",
autostart: false,
preload: true,
init: function () {}
});
Ext.override(copdesk.module_projects, {
getWinLayout: function () {
var desktopEl = Ext.get("x-desktop");
var deskSize = desktopEl.getViewSize();
var winWidth = 452;
var winHeight = deskSize.height - 20;
var left = 0;
var top = 10;
return {
left: left,
top: top,
width: winWidth,
height: winHeight,
max: false
};
},
createWindow: function () {
var me = this;
var desktop = me.app.getDesktop();
var win = Ext.getCmp(me.moduleId);
if (!win) {
if (!desktop.onTopManager) {
desktop.onTopManager = new Ext.WindowGroup({ zseed: 8000 });
desktop.onTopManager.zseed = 8000;
}
var lay = this.getWinLayout();
win = desktop.createWindow({
id: this.moduleId,
xtype: "window",
manager: desktop.onTopManager,
width: lay.width,
cls: "x-tools-std",
height: lay.height,
x: lay.left,
y: lay.top,
maximized: lay.max,
minWidth: 450,
iconCls: "icon-search-projects",
title: cop.lang.title_module_projects,
activeItem: 1,
border: false,
layout: "border",
items: [
{
xtype: "treepanel",
region: "center",
split: true,
autoScroll: true,
loadMask: true,
root: {
nodeType: "async",
text: "Projekte",
id: "projects",
type: "root"
},
id: "proj_tree",
loader: new ux.TreeLoader({
directFn: coprpc.getProjects,
preloadChildren: true,
paramsAsHash: true,
clearOnLoad: true,
listeners: {
beforeload: function (treeLoader, node, cb) {
treeLoader.baseParams.nodeType = node.attributes.type;
return true;
},
load: function (tL, node, res) {
if (tL.baseParams.query) {
node.expandChildNodes(1);
}
return true;
}
}
}),
rootVisible: false,
listeners: {
click: function (node, e) {
if (node.isLeaf() == 1) {
var gT = Ext.getCmp("gridTop");
if (gT) {
var lm = gT.loadMask;
lm.show();
}
coprpc.getProjectArticles(
{ project_id: node.attributes.dbid },
{
success: function (r, t) {
var ps = copdesk.getModule("module_search");
ps.showProjectResult(node.attributes.dbid);
},
failure: function (t, e) {
var lm = Ext.getCmp("gridTop").loadMask;
lm.hide();
var trans = e.getTransaction();
trans.provider.fireEvent("rpcerror", e.error, trans.args);
}
}
);
}
}
},
tbar: [
"Filter:",
new cop.search.field({
id: this.moduleId + "-search",
width: 385,
onTrigger2Click: function () {
this.hasSearch = true;
this.triggers[0].show();
this.fireEvent("execSearch", this);
},
listeners: {
clearSearch: function (field) {
var tree = Ext.getCmp("proj_tree");
var rn = tree.getRootNode();
//rn.removeAll();
tree.getLoader().baseParams = {};
tree.getLoader().load(rn);
},
execSearch: function (field) {
var tree = Ext.getCmp("proj_tree");
var rn = tree.getRootNode();
//rn.removeAll();
//debugger;
tree.getLoader().baseParams = {
query: field.getValue()
};
tree.getLoader().load(rn);
}
}
})
]
}
]
});
}
win.show();
}
});
copdesk.module_configMenu = Ext.extend(Ext.app.Module, {
moduleId: "module_configMenu",
autostart: false,
preload: false,
init: function () {
var mi = [
[cop.lang.title_module_configTarox, "module_configTarox", "icon-configTarox", false, 23],
[cop.lang.title_module_configMemSol, "module_configMemSol", "icon-configMemSol", false, 65],
[cop.lang.title_module_configPrinterCare, "module_configPrinterCare", "icon-configPrinterCare", false, 282],
[cop.lang.title_module_configWortmann, "module_configWortmann", "icon-configWortmann", false, 19],
[cop.lang.title_module_configWortmann, "module_configWortmann", "icon-configWortmann", false, 285]
];
if ([2, 3, 5, 20, 41, 43, 50, 96].indexOf(user_group) === -1) {
mi.splice(2, 1);
}
var i = mi.length;
while (i--) {
if (mod_suppliers.indexOf(mi[i][4]) === -1) {
mi.splice(i, 1);
}
}
this.launcher = {
text: cop.lang.title_module_configMenu,
iconCls: "icon-configurator",
scope: this,
menuPos: 20,
menu: {
items: []
}
};
for (var i = 0; i < mi.length; i++) {
this.launcher.menu.items.push({
text: mi[i][0],
moduleId: mi[i][1],
iconCls: mi[i][2],
handler: function (btn, ev, c, d) {
copdesk.createWindow(btn.moduleId);
},
disabled: mi[i][3]
});
}
}
});
copdesk.module_prodalarm = Ext.extend(Ext.app.Module, {
moduleId: "module_prodalarm",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_calc = Ext.extend(Ext.app.Module, {
moduleId: "module_calc",
autostart: false,
preload: false,
init: function () {
this.title = cop.lang.title_module_calc;
}
});
copdesk.module_media = Ext.extend(Ext.app.Module, {
moduleId: "module_media",
autostart: false,
preload: true,
text: "Media",
init: function () {}
});
Ext.override(copdesk.module_media, {
createWindow: function (mapid, multilang) {
var desktop = this.app.getDesktop();
var win = Ext.getCmp("module_media");
var sid = cp.get("sid");
if (!(sid && sid != "nosid")) {
return;
}
load = function (mapid, multilang) {
coprpc.getArticleData(
{ mapid: mapid, multilang: multilang },
{
success: function (t, e) {
function _update(p, d) {
if (p.rendered) {
p.body.scrollTo("top", 0);
p.update("");
if (d) {
p.update(d);
}
} else {
p.data = d;
}
}
var img = {};
img.image = t.images.length > 0 ? t.images[0][2] : "/images/s.gif";
try {
_update(Ext.getCmp("mm_img"), t);
_update(Ext.getCmp("mm_desc_top"), img);
_update(Ext.getCmp("mm_desc"), t);
} catch (e) {}
var btn = Ext.getCmp("mm_sheet_btn");
var menu = btn.menu;
menu.removeAll();
if (t.sheets.length == 0) {
btn.disable();
} else {
Ext.each(
t.sheets,
function (res, menu) {
menu.add({ text: res[1], url: res[2], handler: btn.menuHandler, scope: btn });
}.createDelegate(this, menu, 1)
);
if (t.sheets.length == 1) {
}
btn.enable();
}
btn.setText(cop.lang.txt_datasheet + ' ' + t.sheets.length + " ");
},
failure: function (t, e) {
var trans = e.getTransaction();
trans.provider.fireEvent("rpcerror", e.error, trans.args);
}
}
);
};
if (!win) {
if (!desktop.onTopManager) {
desktop.onTopManager = new Ext.WindowGroup({ zseed: 8000 });
desktop.onTopManager.zseed = 8000;
}
win = desktop.createWindow({
multilang: multilang,
id: this.moduleId,
iconCls: "icon-details",
title: cop.lang.title_article_details,
width: 250,
height: 500,
manager: desktop.onTopManager,
layout: "fit",
scope: this,
items: [
{
xtype: "tabpanel",
activeTab: 0,
resizeTabs: true,
border: false,
frame: false,
scope: this,
items: [
{
title: cop.lang.txt_overview,
layout: "border",
items: [
{
xtype: "panel",
id: "mm_desc_top",
split: true,
border: true,
frame: false,
region: "north",
height: 150,
tpl: new Ext.XTemplate(
''
)
},
{
xtype: "panel",
id: "mm_desc",
split: true,
border: true,
frame: false,
region: "center",
width: "100%",
autoScroll: true,
tpl: new Ext.XTemplate(
'{[values.descriptions[0][2]]}
',
'',
"
",
'
{[cop.lang.txt_base_features]}
',
"
",
"
",
'',
'{[values[1]]}
{[values[2]]}
{[values[3]]}
',
"",
'',
'',
'',
'',
'{[cop.lang.list_features[values[0]]]} | {[fm.number(values[1],"0.000,00/i")]} | {[this.getUnits(values[0])]} | ',
"",
"
",
"",
'',
'',
'{[values[0]]} | {[values[1]]} | ',
"
",
"",
'',
'',
'',
'Produktart | {[cop.lang.list_features[values[0]]]} | ',
"",
"
",
"",
"
",
"",
'
',
'',
'',
"
",
'
{[cop.lang.txt_warranty]}
',
'
{[values[1].replace(/ ¦ /g,"
")]}
',
"
",
"
",
"",
"",
"
",
'',
'',
'',
'
',
'
{1}
',
'
{2}
',
'
{[cop.lang.product_quality]}: {[cop.lang.product_quality_name[values[50]]]}
',
'
{51}
',
'
Art.Nr. {4}
',
'
WEEE-Reg.-Nr.: {6}
',
'
{3}
',
"
",
"
",
"",
"",
{
getUnits: function (idx) {
var units = [null, "", "kg", "mm", "mm", "mm", "", "", ""];
return units[idx];
}
}
)
}
],
listeners: {
afterrender: function () {}
}
},
{
xtype: "panel",
title: cop.lang.txt_images,
layout: "fit",
id: "mm_img",
autoScroll: true,
autoWidth: true,
tpl: new Ext.XTemplate(
'',
'",
""
),
listeners: {
afterrender: function () {}
}
}
],
listeners: {
tabchange: function () {}
}
}
],
fbar: {
buttonAlign: "left",
items: [
{
xtype: "splitbutton",
id: "mm_sheet_btn",
text: cop.lang.txt_datasheet,
disabled: true,
menuHandler: function (btn, e) {
copdesk.loadStartModule("module_sheet", function (id) {
copdesk.getModule(id).createWindow(btn.url);
});
},
menu: {
id: "mm_sheet_menu"
},
handler: function () {
var fi = this.menu.get(0);
fi.handler(fi, null);
}
},
"->",
{
text: cop.lang.btn_close,
handler: function () {
win.close();
}
}
]
},
listeners: {
beforedestroy: function () {
/*
if(tree.contextMenu){
tree.contextMenu.destroy();
}
*/
},
beforeclose: function () {},
afterlayout: function () {}
}
});
}
if (multilang == true || (multilang == 2 && win.multilang == true)) {
load(mapid, true);
win.multilang = true;
} else {
load(mapid);
win.multilang = false;
}
win.manager.zseed = 8000;
win.show();
}
});
copdesk.module_interfaces = Ext.extend(Ext.app.Module, {
moduleId: "module_interfaces",
autostart: false,
preload: false,
init: function () {
var mi = [
[cop.lang.title_module_import, "module_supCfg", "icon-suppliers"],
[cop.lang.title_module_export, "module_export", "icon-export"],
[cop.lang.title_module_importNotes, "module_importNotes", "icon-import"],
[cop.lang.title_module_importVK, "module_importVK", "icon-import"]
];
this.launcher = {
text: cop.lang.title_module_interfaces,
iconCls: "icon-interfaces",
scope: this,
menuPos: 50,
menu: {
items: []
}
};
for (var i = 0; i < mi.length; i++) {
this.launcher.menu.items.push({
text: mi[i][0],
moduleId: mi[i][1],
iconCls: mi[i][2],
handler: function (btn, ev, c, d) {
copdesk.createWindow(btn.moduleId);
}
});
}
}
});
copdesk.module_log = Ext.extend(Ext.app.Module, {
moduleId: "module_log",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_contactlist = Ext.extend(Ext.app.Module, {
moduleId: "module_contactlist",
autostart: false,
preload: false,
init: function () {
this.launcher = {
text: cop.lang.title_module_contactlist,
iconCls: "icon-contacts ",
scope: this,
menuPos: 60
};
}
});
copdesk.module_cron = Ext.extend(Ext.app.Module, {
moduleId: "module_cron",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_ordercenter = Ext.extend(Ext.app.Module, {
moduleId: "module_ordercenter",
autostart: false,
preload: false,
init: function () {
var mi = [
[cop.lang.title_module_orderlist, "module_orderlist", "icon-orderlist"],
[cop.lang.title_module_orderstatus, "module_orderstatus", "icon-orderstatus"]
];
this.launcher = {
text: cop.lang.title_module_ordercenter,
iconCls: "icon-ordercenter",
scope: this,
menuPos: 40,
menu: {
items: []
}
};
for (var i = 0; i < mi.length; i++) {
this.launcher.menu.items.push({
text: mi[i][0],
moduleId: mi[i][1],
iconCls: mi[i][2],
handler: function (btn, ev, c, d) {
copdesk.createWindow(btn.moduleId);
}
});
}
}
});
copdesk.module_general = Ext.extend(Ext.app.Module, {
moduleId: "module_general",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_orderstatus = Ext.extend(Ext.app.Module, {
moduleId: "module_orderstatus",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_configMemSol = Ext.extend(Ext.app.Module, {
moduleId: "module_configMemSol",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_export = Ext.extend(Ext.app.Module, {
moduleId: "module_export",
autostart: false,
preload: false,
init: function () {
this.title = cop.lang.title_module_export;
}
});
copdesk.module_autotask = Ext.extend(Ext.app.Module, {
moduleId: "module_autotask",
autostart: false,
preload: true
});
Ext.override(copdesk.module_autotask, {
createWindow: function () {
if (copquery.put != undefined) {
var type = copquery.put == "1" ? "EK und VK" : "EK";
var waitCfg = {
title: "Aktualisieren",
msg: "
Artikel " + type + " werden aktualisiert, bitte warten ...
",
width: 350,
wait: true,
waitConfig: { interval: 200 }
};
Ext.MessageBox.show(waitCfg);
coprpc.sendArticlesToAT(
{
articles: [],
queryItems: copquery,
hasATModuleParam: true
},
{
success: function (r, c) {
Ext.MessageBox.hide();
if (copquery.put != undefined) {
cop.msg.alert("Aktualisierung abgeschlossen", "Der Autotask Preis Update wurde erfolgreich abgeschlossen", function () {
window.close();
});
}
},
failure: function (conn, response, options) {
Ext.MessageBox.hide();
cop.msg.error(response.error || response);
}
}
);
}
}
});
copdesk.module_support = Ext.extend(Ext.app.Module, {
moduleId: "module_support",
autostart: false,
preload: true,
init: function () {}
});
Ext.override(copdesk.module_support, {
createWindow: function () {
var desktop = this.app.getDesktop();
var win = desktop.getWindow(this.moduleId);
if (!win) {
win = desktop.createWindow({
id: this.moduleId,
iconCls: "icon-support",
minimizable: false,
maximizable: false,
resizable: false,
title: cop.lang.title_module_support,
width: 480,
height: 380,
layout: "fit",
tpl: new Ext.XTemplate([
'',
"
",
'',
'
',
'
ITscope GmbH',
"
",
"
",
'
',
'
Stuttgarter Straße 24
71665 Vaihingen an der Enz',
"
",
'
",
"
",
'
',
'
Telefon: 07042 / 81434 - 0
Telefax: 07042 / 81434 - 29',
"
",
"
",
'
",
'
",
"
"
]),
fbar: {
buttonAlign: "left",
defaults: {
width: 100
},
items: [
"->",
{
xtype: "button",
text: cop.lang.btn_close,
handler: function () {
win.close();
},
scope: this
}
]
}
});
}
win.show();
win.update();
}
});
copdesk.module_contact = Ext.extend(Ext.app.Module, {
moduleId: "module_contact",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_rmaRequest = Ext.extend(Ext.app.Module, {
moduleId: "module_rmaRequest",
autostart: false,
preload: true,
init: function () {}
});
Ext.override(copdesk.module_rmaRequest, {
createWindow: function (data) {
data = data || {
order_id: 21
};
var desktop = this.app.getDesktop();
var win = Ext.getCmp(this.moduleId);
var me = this;
if (!win) {
var searchTpl = new Ext.XTemplate(
'',
"{name1} {name2} {name3} {name4}
{street} {zipcode} {city} {country}",
"
"
);
var searchContactsTpl = new Ext.XTemplate(
'',
"{name} - {mail}
({department}) {sup_name}",
"
"
);
var saveText = function (_default) {
function _save(a) {
a.is_default = _default;
coprpc.setRMAText(
{
aData: [a]
},
{
success: function (t, e) {
var _t = t.textdata[0];
if (_t.text_id) {
frm.findField("text_id").setValue(_t.text_id);
}
Ext.getCmp("btRMASaveText").setDisabled(true);
storeRMAText.load();
}
}
);
}
var frm = Ext.getCmp("frmRMARequest").getForm();
var t = {};
var r = new RegExp("(text_id|rma_type|rma_desc)", "");
frm.items.each(function (f) {
if (r.exec(f.name)) {
t[f.name] = f.getValue();
}
});
if (!t.rma_type) {
Ext.MessageBox.hide();
cop.msg.alert("", "Fehlende Art der Reklamation!
Bitte geben Sie eine Art der Reklamation für die Speicherung der Textvorlage an.");
return;
}
if (t.text_id) {
cop.msg.confirmex(
"Textblöcke " + (_default ? "als Standard" : "") + " speichern ",
"Änderungen an aktuellem Datensatz speichern oder neuen Datensatz anlegen?",
function (mb, mt) {
if (mb.id == "save_new") {
t.text_id = 0;
_save(t);
} else if (mb.id == "save") {
_save(t);
}
},
[
{
id: "save_new",
text: cop.lang.btn_save_new
},
{
id: "save",
text: cop.lang.btn_save
},
{
id: "cancel",
text: cop.lang.btn_cancel
}
]
);
} else {
_save(t);
}
};
var _frmResetText = function () {
var frm = Ext.getCmp("frmRMARequest").getForm();
var r = new RegExp("(text_id|rma_type|rma_desc)", "");
frm.items.each(function (f) {
if (r.exec(f.name)) {
f.setValue(null);
f.originalValue = null;
}
});
};
var storeOrderStatusItems = new Ext.data.DirectStore({
idProperty: "item_id",
id: "RMARequestItems",
root: "rows",
idIndex: 0,
fields: [
{
name: "item_id",
mapping: "item_id"
},
{
name: "desc_short",
mapping: "desc_short"
},
"man_aid",
"man_name",
{
name: "item_qty",
mapping: "qty_delivered"
},
{
name: "item_remarks",
mapping: "item_remarks"
},
{
name: "map_id",
mapping: "map_id"
},
{
name: "sup_aid",
mapping: "sup_aid"
}
]
});
var storeContacts = new Ext.data.DirectStore({
directFn: coprpc.getConfigSup,
baseParams: {
action: "getContacts"
},
idProperty: "contact_id",
id: "contacts",
root: "rows",
idIndex: 0,
fields: [
{
name: "contact_id",
mapping: "contact_id"
},
{
name: "name",
mapping: "name"
},
{
name: "mail",
mapping: "mail"
},
{
name: "sup_id",
mapping: "sup_id"
},
{
name: "sup_name",
mapping: "sup_name"
},
{
name: "sup_custno",
mapping: "sup_custno"
},
{
name: "department",
mapping: "department"
}
],
sortInfo: {
field: "name",
direction: "ASC"
}
});
var storeRMAText = new Ext.data.DirectStore({
directFn: coprpc.getRMAText,
idProperty: "text_id",
id: "rmatext",
root: "rows",
idIndex: 0,
fields: [
{
name: "text_id",
mapping: "text_id"
},
{
name: "rma_type",
mapping: "rma_type"
},
{
name: "rma_desc",
mapping: "rma_desc"
}
],
listeners: {
load: function (store, recs) {}
}
});
var cbSearchContacts = Ext.extend(Ext.form.ComboBox, {
store: storeContacts,
hideTrigger: true,
pageSize: 0,
minChars: 2,
typeAhead: false,
tpl: searchContactsTpl,
itemSelector: "div.ca-search-item",
listeners: {
beforequery: function (qe) {
var _cb = qe.combo;
var aType = _cb.name.split("$")[1];
var frm = Ext.getCmp("frmRMARequest").getForm();
var _o = {};
var r = new RegExp("address\\$" + aType + "\\$(name|street|zipcode|city|country|contact|phone|fax|email)", "");
frm.items.each(function (f) {
if (r.exec(f.name)) {
var _v = f.getValue();
if (_v) {
_o[f.name] = _v;
}
}
});
_cb.store.baseParams.live_search = _o;
},
select: function (cb, rec, idx) {
var frm = Ext.getCmp("frmRMARequest").getForm();
var _os = rec.json;
var _od = {};
var aType = cb.name.split("$")[1];
for (var _f in _os) {
_od["rma_" + _f] = _os[_f];
}
frm.setValues(_od);
}
}
});
var editorRMA = new Ext.ux.form.LovCombo({
triggerAction: "all",
mode: "local",
displayRaw: true,
editable: false,
valueField: "f_val",
displayField: "f_val",
forceSelection: true,
hideOnSelect: false,
width: 130,
minListWidth: 230,
store: new Ext.data.ArrayStore({
id: 0,
fields: ["f_val", "checked"],
data: [
[1, false],
[2, false],
[3, false]
]
}),
listeners: {
collapse: function (cb, e) {
if (cb.value != "undefined") {
var _this = cb.gridEditor;
_this.setValue(cb.value);
_this.completeEdit();
}
}
}
});
var gridRMAItems = new Ext.grid.EditorGridPanel({
region: "south",
height: 230,
split: true,
border: true,
frame: true,
padding: 0,
autoExpandColumn: "name",
store: storeOrderStatusItems,
clicksToEdit: 2,
selModel: new Ext.grid.CellSelectionModel({}),
viewConfig: {
markDirty: false
},
contextMenu: new Ext.menu.Menu({
scope: this,
items: [
{
text: "Eintrag löschen",
iconCls: "data-delete",
handler: function (b, e) {
var _store = gridRMAItems.getStore();
var _record = gridRMAItems.getSelectionModel().selection.record;
_store.removeAt(_store.indexOf(_record));
}
}
]
}),
cm: new Ext.grid.ColumnModel({
defaults: {
sortable: false
},
columns: [
{
header: "Art.Nr.",
width: 80,
dataIndex: "sup_aid"
},
{
header: "HstArtNo",
width: 80,
dataIndex: "man_aid"
},
{
header: "Hersteller",
width: 80,
dataIndex: "man_name"
},
{
header: "Bezeichnung",
width: 130,
renderer: cop.util.Format.qtip,
dataIndex: "desc_short",
id: "name"
},
{
header: "Menge",
width: 45,
align: "center",
dataIndex: "item_qty",
editor: new Ext.form.NumberField({
allowDecimals: false,
allowNegative: false,
allowBlank: false,
selectOnFocus: true
})
},
{
header: "Seriennr.",
width: 80,
renderer: cop.util.Format.qtip,
dataIndex: "serials",
editor: editorRMA
},
{
header: "Lieferschein",
width: 80,
renderer: cop.util.Format.qtip,
dataIndex: "del_notes",
editor: editorRMA
},
{
header: "Paketnr.",
width: 80,
renderer: cop.util.Format.qtip,
dataIndex: "packages",
editor: editorRMA
}
]
}),
listeners: {
cellcontextmenu: function (grid, rowIndex, cellIndex, e) {
e.stopEvent();
var _sm = grid.getSelectionModel();
_sm.select(rowIndex, cellIndex);
grid.contextMenu.showAt(e.getXY());
},
beforeedit: function (e) {
var _data = [];
if (e.field == "serials") {
Ext.each(e.record.json.serials, function (item) {
_data.push([item, true]);
});
} else if (e.field == "del_notes") {
Ext.each(e.record.json.qty_date_delivered, function (item) {
_data.push([item.delnote_id, true]);
});
} else if (e.field == "packages") {
Ext.each(e.record.json.qty_date_delivered, function (item) {
Ext.each(item.package_info, function (item2) {
_data.push([item2.package_id, true]);
});
});
}
editorRMA.store.loadData(_data);
}
}
});
var pOrderInfo = {
layout: "form",
frame: "true",
title: "Bestelldaten",
style: "margin-right:3px",
// padding: 3,
items: [
{
name: "sup_name",
xtype: "textfield",
anchor: "100%",
fieldLabel: "Lieferant"
},
{
name: "sup$sup_custno",
xtype: "textfield",
anchor: "100%",
fieldLabel: "Kundennummer"
},
{
name: "order_name",
xtype: "textfield",
anchor: "100%",
fieldLabel: "Bezeichnung"
},
{
name: "customer_po",
xtype: "textfield",
anchor: "100%",
fieldLabel: "Bestellnummer"
}
]
};
var pContact = {
layout: "form",
frame: "true",
title: "Kontaktdaten",
items: [
{
name: "contact$name",
xtype: "textfield",
anchor: "100%",
allowBlank: false,
fieldLabel: "Ansprechpartner"
},
{
name: "contact$phone",
xtype: "textfield",
anchor: "100%",
fieldLabel: "Telefonnummer"
},
{
name: "contact$email",
xtype: "textfield",
anchor: "100%",
allowBlank: false,
fieldLabel: "Mailadresse"
}
]
};
var pRMAInfo = {
layout: "form",
frame: "true",
style: "margin-top:3px",
title: "Angaben zur Reklamation",
labelWidth: 150,
// padding: 3,
items: [
new cbSearchContacts({
name: "rma_name",
anchor: "100%",
fieldLabel: "Ansprechpartner"
}),
{
xtype: "textfield",
name: "rma_mail",
anchor: "100%",
fieldLabel: "An eMail",
allowBlank: false
//style:'margin-bottom:10px'
},
{ name: "text_id", xtype: "hidden" },
{
anchor: "50%",
name: "rma_type",
fieldLabel: "Art der Reklamation",
xtype: "combo",
store: storeRMAText,
mode: "local",
triggerAction: "all",
displayField: "rma_type",
valueField: "text_id",
allowBlank: false,
listeners: {
select: function (cb, rec) {
var frm = Ext.getCmp("frmRMARequest").getForm();
var r = new RegExp("(text_id|rma_type|rma_desc)", "");
frm.items.each(function (f) {
if (r.exec(f.name)) {
f.setValue(rec.data[f.name]);
}
});
},
focus: function (cb, rec) {
Ext.getCmp("btRMASaveText").setDisabled(false);
}
}
},
{
xtype: "textarea",
name: "rma_desc",
anchor: "100%",
height: 140,
fieldLabel: "Beschreibung",
allowBlank: false
},
{
xtype: "container",
disabled: false,
layout: "column",
labelStyle: "display:none",
items: [
{
id: "btRMAResetText",
xtype: "button",
//disabled:true,
text: cop.lang.btn_reset,
width: 100,
style: "float:right",
handler: function () {
_frmResetText();
}
},
{
id: "btRMASaveText",
disabled: true,
xtype: "button",
text: cop.lang.btn_save,
width: 100,
style: "float:right;margin-right:10px",
handler: function () {
saveText();
}
}
]
}
]
};
var tp = new Ext.TabPanel({
activeTab: 0,
border: false,
// deferredRender: false,
// items : [{title: 'Allgemein',html: 'A simple tab'}]
items: [
{
title: "Allgemein",
border: true,
frame: true,
items: [
{
layout: "column",
border: false,
defaults: {
columnWidth: 0.5,
labelWidth: 120
},
items: [pOrderInfo, pContact]
},
pRMAInfo
]
}
]
});
var fp = new Ext.FormPanel({
region: "center",
id: "frmRMARequest",
layout: "fit",
items: [tp]
});
win = desktop.createWindow({
xtype: "window",
id: this.moduleId,
width: 800,
height: 760,
border: false,
resizeable: false,
stateful: false,
cls: "x-tools-std",
iconCls: "icon-rma",
title: "RMA Abwicklung",
layout: "border",
items: [fp, gridRMAItems],
fbar: {
buttonAlign: "left",
defaults: {
width: 100
},
items: [
{
text: "Senden",
handler: function () {
var frm = Ext.getCmp("frmRMARequest").getForm();
if (frm.isValid()) {
Ext.MessageBox.show({
title: "Sende",
msg: "
Projektanfrage wird übermittelt, bitte warten ...
",
width: 300,
wait: true,
waitConfig: {
interval: 200
}
});
var data = Ext.StoreMgr.get("RMARequestItems").getRange();
var items = [];
for (var i = 0; i < data.length; i++) {
items.push(data[i].data);
}
coprpc.sendRMARequest(
{
data: frm.getFieldValues(),
items: items
},
{
success: function (t, e) {
Ext.MessageBox.hide();
win.close();
},
failure: function (t, e) {
Ext.MessageBox.hide();
cop.msg.error(e.error);
}
}
);
}
}
},
"->",
{
text: cop.lang.btn_cancel,
handler: function () {
win.close();
}
}
]
}
});
}
this.loadData(data);
win.show();
},
loadData: function (data) {
var _store = Ext.StoreMgr.get("rmatext");
_store.load();
coprpc.getOrders(
{
oData: {
order_id: data.order_id
}
},
{
success: function (t, e) {
var frm = Ext.getCmp("frmRMARequest").getForm();
var o = {};
order = t.rows[0];
delete order.info;
obj2flat(order, "", o);
// JSONdecodeDate(o);
// console.log(o);
frm.setValues(o);
// loadNoteItems(note.note_id);
}
}
);
coprpc.getOrderStatusItems(
{
oData: {
order_id: data.order_id,
items: data.items
}
},
{
success: function (t, e) {
var store = Ext.StoreMgr.get("RMARequestItems");
store.loadData(t);
}
}
);
}
});
copdesk.module_promo = Ext.extend(Ext.app.Module, {
moduleId: "module_promo",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_supCfg = Ext.extend(Ext.app.Module, {
moduleId: "module_supCfg",
autostart: false,
preload: true,
init: function () {}
});
/* MODULE SUPPLIER CONFIG */
Ext.override(copdesk.module_supCfg, {
changeAllowed: false,
enableForms: function (cA) {
this.changeAllowed = cA;
Ext.getCmp("frm_sup")
.getForm()
.items.each(function (itm) {
if (itm.readOnly !== true) {
itm.setDisabled(!(this.changeAllowed || false));
}
}, this);
this.CheckColumn.disabled = !(this.changeAllowed || false);
Ext.getCmp("supCfgImportBtn").setDisabled(!(this.changeAllowed || false));
},
hideDownload: function (show, frm) {
var frm_download = frm.findById("frm_sup$download");
if (frm_download) {
frm_download.items.each(function (item, idx, len) {
if (item.id != "stdPrice") {
item.setVisible(show);
}
});
}
},
hideShip: function (show, frm) {
var frm_ship = frm.findById("frm_sup$shipleft");
if (frm_ship) {
frm_ship.items.each(function (item, idx, len) {
if (item.id != "stdShip") {
item.setDisabled(!show);
}
});
}
var frm_ship = frm.findById("frm_sup$shipright");
if (frm_ship) {
frm_ship.items.each(function (item, idx, len) {
if (item.id != "stdShip") {
item.setDisabled(!show);
}
});
}
},
hideConditions: function (show, frm) {
var frm_conditions = frm.findById("frm_sup$conditions");
if (frm_conditions) {
frm_conditions.items.each(function (item, idx, len) {
if (item.id != "stdConditions") {
item.setDisabled(!show);
}
});
}
},
saveSup: function (only, rec) {
// debugger;
if (this.changeAllowed !== true) {
return;
}
try {
var o = {};
var _store = Ext.StoreMgr.get("store_supcfg");
if (!only) {
var frm = Ext.getCmp("frm_sup").getForm();
flat2obj(frm.getFieldValues(), o);
o.enabled = _store.getById(o.sup_id).get("enabled");
} else {
_store.commitChanges();
o.enabled = rec.get("enabled");
o.sup_id = rec.get("sup_id");
}
coprpc.setConfigSup(
{
data: o,
only: only
},
{
success: function (t, e) {}
}
);
} catch (e) {}
},
_frm: {
id: "frm_sup",
trackResetOnLoad: false,
frame: false,
border: false,
layout: "border",
items: [
{
id: "frm_sup$main",
region: "north",
height: 85,
margins: {
top: 0,
right: 0,
bottom: 4,
left: 0
}
},
{
region: "center",
xtype: "tabpanel",
id: "supCfgTabPanel",
deferredRender: false,
activeTab: 1,
border: false,
items: [
{
title: "Zugangsdaten",
autoScroll: true,
frame: true,
items: [{ id: "frm_sup$info" }, { id: "frm_sup$download" }, { id: "frm_sup$oc" }, { id: "frm_sup$oo" }]
},
{
title: "Lieferkosten",
autoScroll: true,
frame: true,
items: [
{
layout: "column",
items: [{ id: "frm_sup$shipleft" }, { id: "frm_sup$shipright" }]
},
{ id: "frm_sup$shipinfo" }
]
},
{
title: "Kontaktdaten",
frame: true,
items: [
{ id: "frm_sup$contact" },
{
layout: "column",
items: [
{ id: "frm_sup$cust_contact" },
{ xtype: "panel", width: 5, html: " " },
{ id: "frm_sup$cust_contact2" },
{ id: "frm_sup$cust_contact3" },
{ xtype: "panel", width: 5, html: " " },
{ id: "frm_sup$cust_contact4" }
]
}
]
},
{ id: "frm_sup$conditions" }
]
}
]
},
defaults: {
frm_fields: {
main: {
title: "Einstellungen & Daten",
layout: "column",
items: [
{
xtype: "panel",
layout: "form",
columnWidth: 0.5,
labelWidth: 130,
items: [
{
xtype: "textfield",
anchor: "98%",
name: "sup_company",
fieldLabel: "Lieferant",
readOnly: true,
style: "border:none;background:none;"
},
{
xtype: "textfield",
name: "sup_custno",
anchor: "98%",
fieldLabel: "Kundennummer",
listeners: {
change: function () {
copdesk.getModule("module_supCfg").saveSup();
}
}
}
]
},
{
xtype: "panel",
layout: "form",
columnWidth: 0.5,
labelWidth: 130,
items: [
{
xtype: "textfield",
name: "sup_oid",
anchor: "98%",
fieldLabel: "Kreditorennummer",
listeners: {
change: function () {
copdesk.getModule("module_supCfg").saveSup();
}
}
},
{
xtype: "combo",
fieldLabel: "Reiter",
name: "tab",
mode: "local",
anchor: "98%",
store: [
["main", "Standard"],
["extended", "Weitere"]
],
valueField: "type",
displayField: "displayText",
triggerAction: "all",
editable: false,
readOnly: false,
listeners: {
change: function () {
copdesk.getModule("module_supCfg").saveSup();
}
}
},
{
xtype: "textfield",
anchor: "98%",
name: "sup_id",
hidden: "true"
}
]
}
]
},
download: {
title: "Preisliste",
items: [
{ name: "download$0$user", fieldLabel: "Kennung" },
{ name: "download$0$pass", fieldLabel: "Passwort" }
]
},
oc: {
title: "OnlineCheck",
items: [
{ name: "oc$user", fieldLabel: "Kennung" },
{ name: "oc$pass", fieldLabel: "Passwort" }
]
},
oo: {
title: "OnlineOrder",
items: [
{ name: "oo$user", fieldLabel: "Kennung" },
{ name: "oo$pass", fieldLabel: "Passwort" }
]
},
conditions: {
title: "Konditionen",
items: [
{ name: "conditions$payment", fieldLabel: "Zahlungsziel (Tage)" },
{ name: "conditions$discount", fieldLabel: "Skonto %", xtype: "numberfield", value: 0 },
{ name: "conditions$bonus", fieldLabel: "Bonus 1 %", xtype: "numberfield", value: 0 },
{ name: "conditions$frontup", fieldLabel: "Bonus 2 %", xtype: "numberfield", value: 0 }
]
},
shipleft: {
columnWidth: 0.5,
frame: false,
items: [
{ name: "ship$amount", fieldLabel: "Frachtkosten", xtype: "numberfield", value: 0 },
{ name: "ship$free", fieldLabel: "Frachtfrei ab", xtype: "numberfield", value: 0 },
{ name: "ship$minamount", fieldLabel: "Mindermengenzuschlag", xtype: "numberfield", value: 0 },
{ name: "ship$minto", fieldLabel: "Mindermenge bis", xtype: "numberfield", value: 0 },
{ name: "ship$minorder", fieldLabel: "Mindestbestellwert", xtype: "numberfield", value: 0 }
]
},
shipright: {
columnWidth: 0.5,
frame: false,
items: [
{
xtype: "combo",
fieldLabel: "Sonstige Kosten in",
id: "ship$examountcalc",
name: "ship$examountcalc",
mode: "local",
store: [
["percent", "Prozent"],
["euro", "Euro"]
],
valueField: "type",
displayField: "displayText",
triggerAction: "all",
editable: false,
readOnly: false
},
{ name: "ship$examount", fieldLabel: "Sonstige Kosten", xtype: "numberfield", value: 0 },
{
xtype: "combo",
fieldLabel: "Sonstige Kosten in",
id: "ship$examountcalc2",
name: "ship$examountcalc2",
mode: "local",
store: [
["percent", "Prozent"],
["euro", "Euro"]
],
valueField: "type",
displayField: "displayText",
triggerAction: "all",
editable: false,
readOnly: false
},
{ name: "ship$examount2", fieldLabel: "Sonstige Kosten", xtype: "numberfield", value: 0 }
]
},
contact: {
title: "Zentrale",
items: [
{ name: "contact$address", fieldLabel: "Adresse" },
{ name: "contact$web", fieldLabel: "Homepage" },
{ name: "contact$mail", fieldLabel: "eMail" },
{ name: "contact$phone", fieldLabel: "Telefon" }
]
},
cust_contact: {
columnWidth: 0.5,
title: "Ansprechpartner",
items: [
{ name: "contact$department", fieldLabel: "Bereich" },
{ name: "contact$name", fieldLabel: "Name" },
{ name: "contact$mail_pers", fieldLabel: "eMail" },
{ name: "contact$phone_pers", fieldLabel: "Telefon" },
{ name: "contact$fax", fieldLabel: "Fax" }
]
},
cust_contact2: {
columnWidth: 0.5,
title: "Ansprechpartner",
items: [
{ name: "contact2$department", fieldLabel: "Bereich" },
{ name: "contact2$name", fieldLabel: "Name" },
{ name: "contact2$mail", fieldLabel: "eMail" },
{ name: "contact2$phone_pers", fieldLabel: "Telefon" },
{ name: "contact2$fax", fieldLabel: "Fax" }
]
}
},
panel: {
layout: "form",
style: "margin-bottom:5px",
frame: true,
labelWidth: 130,
defaults: {
anchor: "98%",
listeners: {
change: {
fn: function () {
// this.saveSup();
copdesk.getModule("module_supCfg").saveSup();
}
// scope:this
}
}
},
defaultType: "textfield"
}
},
createFormCfg: function (config) {
clone = function (obj) {
var newObj = obj instanceof Array ? [] : {};
for (i in obj) {
if (obj[i] && typeof obj[i] == "object") {
newObj[i] = clone(obj[i]);
} else newObj[i] = obj[i];
}
return newObj;
};
var cfg = clone(this._frm);
var f = clone(this.defaults.frm_fields);
//var cfg = Ext.decode(Ext.encode(this._frm));
//var f = Ext.decode(Ext.encode(this.defaults.frm_fields));
Ext.apply(f, config || {});
_applyConfig = function (name, value, obj) {
// console.log(name,value,obj);
if (!Ext.isPrimitive(value)) {
if (Ext.isArray(value)) {
Ext.each(
value,
function (item, idx, allItems) {
Ext.iterate(item, _applyConfig, this);
},
this
);
}
} else {
if (name == "id") {
var o = f[value.replace(/frm_sup\$/, "")];
if (o) {
Ext.apply(obj, o, this.defaults.panel);
}
}
}
};
Ext.iterate(cfg, _applyConfig, this);
return cfg;
},
loadSup: function (rdata, tabnumber) {
var item = 0;
cmp = Ext.getCmp("supCfg$card");
if (rdata.fields) {
cmp.remove("frm_sup");
var frm_cfg = this.createFormCfg.createDelegate(this)(rdata.fields || {});
var frm = new Ext.form.FormPanel(frm_cfg);
var comboPrice = frm.findById("stdPrice");
var comboShip = frm.findById("stdShip");
var comboConditions = frm.findById("stdConditions");
if (comboPrice) {
comboPrice.on(
"select",
function (field, record, idx) {
this.hideDownload(record.get("field1") == 2, frm);
},
this
);
}
if (comboShip) {
comboShip.on(
"select",
function (field, record, idx) {
this.hideShip(record.get("field1") == 2, frm);
},
this
);
}
if (comboConditions) {
comboConditions.on(
"select",
function (field, record, idx) {
this.hideConditions(record.get("field1") == 2, frm);
},
this
);
}
cmp.add(frm);
cmp.lastCustom = true;
} else {
if (cmp.lastCustom) {
cmp.remove("frm_sup");
var frm_cfg = this.createFormCfg.createDelegate(this)();
var frm = new Ext.form.FormPanel(frm_cfg);
var comboPrice = frm.findById("stdPrice");
if (comboPrice) {
comboPrice.on(
"select",
function (field, record, idx) {
this.hideDownload(record.get("field1") == 2, frm);
},
this
);
}
cmp.add(frm);
}
var frm = Ext.getCmp("frm_sup");
cmp.lastCustom = false;
}
var data = {};
delete rdata.fields;
obj2flat(rdata, "", data);
frm.getForm().items.each(function (f) {
f.originalValue = null;
});
frm.getForm().reset();
var comboPrice = frm.findById("stdPrice");
var comboShip = frm.findById("stdShip");
var comboConditions = frm.findById("stdConditions");
// debugger;
cmp.layout.setActiveItem(item);
frm.getForm().items.each(function (itm) {
if (itm.readOnly !== true) {
itm.setDisabled(!(this.changeAllowed || false));
}
}, this);
if (this.changeAllowed) {
if (comboPrice) {
if (!data.download$0$standard) {
data.download$0$standard = 1;
}
this.hideDownload(data.download$0$standard == 2, frm);
}
if (comboShip) {
if (!data.ship$standard) {
data.ship$standard = 1;
}
this.hideShip(data.ship$standard == 2, frm);
}
if (comboConditions) {
if (!data.conditions$standard) {
data.conditions$standard = 1;
}
this.hideConditions(data.conditions$standard == 2, frm);
}
}
frm.getForm().setValues(data);
// debugger;
var tabPanel = Ext.getCmp("supCfgTabPanel");
if (typeof tabnumber === "number") {
tabPanel.setActiveTab(tabnumber);
} else if (this.isSupplierInfo) {
tabPanel.setActiveTab(1);
} else {
tabPanel.setActiveTab(0);
}
Ext.getCmp("pSupCfg").loadMask.hide();
},
handleImport: function (btn, e) {
copdesk.getModule("module_supCfg").saveSup();
// this.saveSup();
var o = {
simport: true
};
switch (btn.sup_id) {
case "normal":
case "full":
o.type = btn.sup_id;
break;
default:
o.suppliers = [btn.sup_id];
}
coprpc.startImport(o, {
success: function (t, e) {
switch (t.msg_id) {
case 0:
cop.pr = null;
copdesk.import_start = t.import_start;
cop.LogTask();
break;
case 1:
new cop.window.message({
headline: cop.lang.title_import_running,
message: cop.lang.txt_import_running
}).show();
break;
case 2:
new cop.window.message({
headline: "Import Info",
message: t.msg
}).show();
break;
}
}
});
},
createWindow: function (sup_id, _modal, tabnumber) {
var desktop = this.app.getDesktop();
var win = desktop.getWindow(this.moduleId);
var sid = cp.get("sid");
if (!(sid && sid != "nosid")) {
return;
}
coprpc.setConfigSup(
{ checkOnly: true },
{
success: function (t, e) {
var m = copdesk.getModule("module_supCfg");
m.enableForms(true);
// debugger;
},
failure: function (t, e) {
var m = copdesk.getModule("module_supCfg");
m.enableForms(false);
// debugger;
}
}
);
// debugger;
var _createWin;
if (_modal && win) {
win.close();
win = null;
_createWin = function (cfg) {
return new Ext.Window(cfg);
};
} else if (_modal) {
_createWin = function (cfg) {
return new Ext.Window(cfg);
};
} else {
_createWin = desktop.createWindow;
}
if (!win) {
var _mainPanel = Ext.extend(Ext.Panel, {
initEvents: function () {
_mainPanel.superclass.initEvents.call(this);
if (this.loadMask) {
this.loadMask = new Ext.LoadMask(
this.bwrap,
Ext.apply(
{
store: Ext.StoreMgr.get("store_supcfg")
},
this.loadMask
)
);
}
}
});
var _store = new Ext.data.DirectStore({
directFn: coprpc.getConfigSup,
reader: new Ext.data.JsonReader({}),
id: "store_supcfg",
autoSave: false,
remoteSort: true,
listeners: {
load: function () {
var m = copdesk.getModule("module_supCfg");
if (!m.isSupplierInfo) {
Ext.getCmp("supCfgGrid").selModel.selectFirstRow();
}
// debugger;
// Ext.getCmp('supCfgGrid').selModel.selectFirstRow();
}
}
});
var cC = new Ext.grid.CheckColumn({
header: " ",
dataIndex: "enabled",
disabled: true,
width: 20,
id: "cCsupCfg"
});
this.CheckColumn = cC;
var frm_cfg = this.createFormCfg.createDelegate(this)();
var frm = new Ext.form.FormPanel(frm_cfg);
// win = desktop.createWindow({
win = _createWin({
id: this.moduleId,
stateful: false,
iconCls: "icon-suppliers",
layout: "fit",
title: cop.lang.title_module_import,
width: 1000,
modal: _modal,
height: 700,
resizable: false,
maximizable: false,
border: false,
items: [
new _mainPanel({
loadMask: {},
id: "pSupCfg",
layout: "border",
border: false,
items: [
{
xtype: "grid",
margins: {
top: 0,
right: 4,
bottom: 0,
left: 0
},
id: "supCfgGrid",
region: "west",
width: 180,
store: Ext.StoreMgr.get("store_supcfg"),
autoExpandColumn: "sup",
enableHdMenu: false,
plugins: [cC],
columns: [
cC,
{
xtype: "gridcolumn",
header: "Lieferant",
sortable: true,
resizable: false,
width: 100,
dataIndex: "sup_name",
id: "sup"
}
],
viewConfig: {
getRowClass: function (record, index) {
var _fc = record.get("frontend_cfg");
// console.log(_fc);
if (_fc.cc_contract === true && user_group == 5) {
return "cc_contract";
}
}
},
selModel: new Ext.grid.RowSelectionModel({
listeners: {
rowselect: function (sm, rowIdx, r) {
Ext.getCmp("pSupCfg").loadMask.show();
coprpc.getConfigSup(
{
supid: r.get("sup_id")
},
{
success: function (r, o) {
this.loadSup(r.config, tabnumber);
}.createDelegate(this)
}
);
}.createDelegate(this)
}
}),
listeners: {
afteredit: {
fn: function (e) {
// this.saveSup(true,e.record);
copdesk.getModule("module_supCfg").saveSup(true, e.record);
},
scope: this
}
}
},
{
id: "supCfg$card",
layout: "card",
region: "center",
activeItem: 0,
deferredRender: false,
border: false,
items: [frm]
}
]
})
],
fbar: {
xtype: "toolbar",
buttonAlign: "left",
items: [
{
xtype: "splitbutton",
split: true,
text: "Import",
sup_id: "normal",
width: 100,
handler: this.handleImport,
scope: this,
disabled: true,
id: "supCfgImportBtn",
menu: {
items: [
{
text: "Import",
sup_id: "normal",
handler: this.handleImport,
scope: this
},
{
text: "Vollimport",
sup_id: "full",
handler: this.handleImport,
scope: this
}
]
}
},
"->" /*{
text:cop.lang.btn_save,
width:100,
handler:function(){
this.saveSup()//this.ownerCt.close.createDelegate(this.ownerCt));
},
scope:this
},*/,
{
text: cop.lang.btn_close,
width: 100,
handler: function () {
// this.saveSup();
copdesk.getModule("module_supCfg").saveSup();
// var desktop = this.app.getDesktop();
// var win = desktop.getWindow(this.moduleId);
win.close();
},
scope: this
}
]
}
});
}
if (!_store) {
_store = Ext.StoreMgr.get("store_supcfg");
}
if (sup_id) {
this.isSupplierInfo = true;
} else {
this.isSupplierInfo = false;
}
_store.load({
callback: function (records, options, success) {
// var rec = this.getAt(this.findExact('sup_id', sup_id));
if (sup_id) {
Ext.getCmp("supCfgGrid").selModel.selectRow(this.findExact("sup_id", sup_id));
}
// console.log(sup_id);
// debugger;
}
});
win.show();
}
});
copdesk.module_start = Ext.extend(Ext.app.Module, {
moduleId: "module_start",
autostart: true,
preload: true,
init: function () {}
});
Ext.override(copdesk.module_start, {
createWindow: function () {
document.title = "Nordanex - NEOS";
var showModule = function () {
copdesk.createWindow("module_" + copquery.module);
};
copquery = copquery == null ? {} : copquery;
if (copquery.module) {
Ext.getBody().setStyle("padding", "0px");
Ext.fly("ux-taskbar").setStyle("display", "none");
Ext.fly("x-desktop-head").setStyle("display", "none");
Ext.getBody().setStyle("background", "#192B72");
}
var inCheck = function (sid) {
if (copquery.relogin) {
return;
}
if (sid && sid != "nosid") {
if (copquery.module) {
showModule();
} else {
if (_login) {
// Dadurch das beim Login die Taskbar nicht angezeigt wird ist x-desktop größer als es nach der Anmeldung sein wird
var desktopEl = Ext.get("x-desktop");
desktopEl.dom.style.height = desktopEl.getViewSize().height - 52 + "px";
}
Ext.getBody().setStyle("padding", "10px");
Ext.getBody().setStyle("background", "#192B72");
Ext.fly("ux-taskbar").show();
Ext.fly("x-desktop").setStyle("overflow", "hidden");
copdesk.createWindow("module_widgets");
coprpc.checkModule(
{ moduleId: "module_search" },
{
success: function (res, req) {
// console.log(res,req);
if (res && res.success === true) {
copdesk.createWindow("module_search");
}
},
failure: function () {
// console.log("Fail",arguments)
}
}
);
var mpa = Ext.util.Cookies.get("ys-module_promo_auto");
if (mpa != "false") {
coprpc.checkModule(
{ moduleId: "module_promo" },
{
success: function (res, req) {
// console.log(res,req);
if (res && res.success === true) {
copdesk.createWindow("module_promo");
}
},
failure: function () {
// console.log("Fail",arguments)
}
}
);
// copdesk.createWindow('module_promo');
}
}
cop.LogTask();
return true;
}
};
var test = function () {
cop.MsgTask = Ext.TaskMgr.start(cop.MsgTask);
wGroup.each(function (w) {
w.destroy();
});
inCheck(cp.get("sid"));
};
if (inCheck(cp.get("sid"))) {
return;
} else {
if (copquery.module) {
coprpc.login(
{ username: copquery.user || "", password: copquery.passsha1 || hex_sha1(copquery.pass || ""), relogin: true, sid: "" },
{
success: function (d) {
cp.set("sid", d.sid);
showModule();
},
failure: function (t, e, o) {
cp.set("sid", "nosid");
cop.msg.login({
success: function (d) {
cp.set("sid", d.sid);
showModule();
},
cancel: function () {
cp.set("sid", "nosid");
window.location.reload();
}
});
}
}
);
return;
} else if (copquery.user && copquery.pass) {
coprpc.login(
{ username: copquery.user || "", password: hex_sha1(copquery.pass || ""), relogin: true, sid: "" },
{
success: function (d) {
cp.set("sid", d.sid);
copdesk.desktop.taskbar.setStartBtn(true);
test();
},
failure: function (t, e, o) {
cp.set("sid", "nosid");
cop.msg.login({
success: function (d) {
cp.set("sid", d.sid);
showModule();
},
cancel: function () {
cp.set("sid", "nosid");
window.location.reload();
}
});
}
}
);
}
var _login = true;
Ext.getBody().setStyle("padding", "0px");
Ext.fly("ux-taskbar").setStyle("display", "none");
var desktop = this.app.getDesktop();
var win = desktop.getWindow(this.moduleId);
var wGroup = desktop.getManager();
var dEl = Ext.get("x-desktop");
var _win = [];
dEl.setStyle("overflowY", "auto");
dEl.setStyle("background", "none");
pWinDefaults = {
taskHidden: true,
minimizable: false,
maximizable: false,
resizable: false,
closable: false,
draggable: false,
border: false,
style: "padding:5px",
constrain: false
};
desktop.createWindow(
Ext.apply(
{},
{
title: "",
width: "100%",
height: desktop.getWinHeight(),
scope: this,
frame: false,
style: "padding:0px;margin:0px;border:0px",
bodyStyle: "border:0px solid #cccccc;background:#ffffff",
layout: "border",
items: [
{
xtype: "container",
height: 32,
region: "north",
//style: 'background-color:#ffffff;background:url(/skin/images/soennecken.svg ) no-repeat 50px 40px; background-size: 350px;',
layout: "anchor",
items: [
{
xtype: "login-panel-formex",
itemId: "loginForm",
cookieProvider: cp,
height: 32,
bodyStyle:
"background-color:#192B72;color:#ffffff;padding-top:5px;font-weight:bold;padding-left:15px;font-family: Arial, Helvetica, sans-serif;",
onLogin: function (t) {
Ext.fly("ux-taskbar").setStyle("display", "block");
Ext.getBody().setStyle("background", "#192B72");
copdesk.desktop.taskbar.setStartBtn(true);
test();
},
scope: this
}
]
},
new Ext.ux.IFrameComponent({
region: "center",
id: "startPage_Iframe",
url: ""
})
],
listeners: {
beforerender: function () {
Ext.EventManager.onWindowResize(function () {
if (this.isVisible()) {
this.hide();
this.setSize(desktop.getWinWidth(), desktop.getWinHeight());
this.setSize(this.width, desktop.getWinHeight() - 10);
this.show();
}
}, this);
}
}
},
pWinDefaults
)
);
function imageLoaded() {
Ext.getCmp("startPage_Iframe").setUrl("https://www.nordanex.de/neos");
}
function imageError() {
Ext.getCmp("startPage_Iframe").setUrl("/error_offline.html");
}
online_Image = new Image();
online_Image.onload = imageLoaded;
online_Image.onerror = imageError;
online_Image.onabort = imageError;
online_Image.src = "https://www.coppage.de/cop/joomla/images/check.gif";
wGroup.each(function (w) {
w.show();
});
}
}
});
copdesk.module_orderlist = Ext.extend(Ext.app.Module, {
moduleId: "module_orderlist",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_equipment = Ext.extend(Ext.app.Module, {
moduleId: "module_equipment",
autostart: false,
preload: true,
init: function () {}
});
Ext.override(copdesk.module_equipment, {
getWinLayout: function () {
var desktopEl = Ext.get("x-desktop");
var deskSize = desktopEl.getViewSize();
var winWidth = deskSize.width - 260;
var winHeight = deskSize.height - 20;
var left = 260;
var top = 10;
if (winWidth < 840 || winHeight < 550) {
return {
left: 0,
top: 0,
width: deskSize.width,
height: deskSize.height,
max: true
};
} else {
return {
left: left,
top: top,
width: winWidth,
height: winHeight,
max: false
};
}
},
createWindow: function (mapid, project_id) {
var desktop = this.app.getDesktop();
var win = desktop.getWindow(this.moduleId);
var win_id = this.moduleId;
var sid = cp.get("sid");
if (!(sid && sid != "nosid")) {
return;
}
if (!win) {
PopupCenter = function (pageURL, title, w, h) {
var left = screen.width / 2 - w / 2;
var top = screen.height / 2 - h / 2;
window.open(
pageURL,
title,
"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=" +
w +
", height=" +
h +
", top=" +
top +
", left=" +
left
);
};
showDatasheet = function (map_id, setfocus) {
coprpc.getArticleData(
{
mapid: map_id,
media: 2
},
{
success: function (t, _e) {
if (t.url) {
if (Ext.getCmp("module_sheet") && !setfocus) {
Ext.getCmp("mm_sheet_Iframe").setUrl(t.url);
} else {
copdesk.loadStartModule("module_sheet", function (id) {
copdesk.getModule(id).createWindow(t.url);
});
}
} else {
if (Ext.getCmp("module_sheet")) {
Ext.getCmp("mm_sheet_Iframe").setUrl("about:blank");
}
}
}
}
);
};
showPdf = function (map_id) {
coprpc.getArticleData(
{
mapid: map_id,
media: 1
},
{
success: function (t, _e) {
if (t.url) {
PopupCenter(t.url, window.title, screen.width * 0.8, screen.height * 0.8);
}
}
}
);
};
var dsMain = new Ext.data.DirectStore({
id: win_id + "-dsMain",
root: "rows",
totalProperty: "results",
remoteSort: true,
proxy: new Ext.data.DirectProxy({
directFn: coprpc.getEq,
listeners: {
load: function (_proxy, _o, _options) {
/*
Ext.getCmp(win_id + "-searchDuration").setText(
String.format("({0} s)", o.result.times.complete)
);
*/
}
}
}),
fields: [
{
name: "man_name",
mapping: 0
},
{
name: "desc_short",
mapping: 1
},
{
name: "ean",
mapping: 2
},
{
name: "man_aid",
mapping: 3
},
{
name: "price_min",
mapping: 4
},
{
name: "evp",
mapping: 5
},
{
name: "map_id",
mapping: 6
},
{
name: "hasEq",
mapping: 7
},
{
name: "pic",
mapping: 8
},
{
name: "sheet",
mapping: 9
},
{
name: "qty_status",
mapping: 10
},
{
name: "pic_cnet",
mapping: 11
},
{
name: "sheet_cnet",
mapping: 12
},
/*Verkaufspreisanzeige*/
{
name: "vk",
mapping: 13
},
{
name: "vk_brutto",
mapping: 14
},
{
name: "pid",
mapping: 15
},
{
name: "bookmark",
mapping: 16
},
{
name: "prod_type",
mapping: 18
},
{
name: "project_price",
mapping: 19
},
{
name: "project_id",
mapping: 20
},
{
name: "price_min_avail",
mapping: 21
}
],
/*
sortInfo : {
field : 'map_id',
direction : 'ASC'
},
*/
listeners: {
load: function (_store, recs, o) {
var gt = Ext.getCmp(win_id + "-gridTop");
var gb = Ext.getCmp(win_id + "-ms_gB");
if (gt && gb) {
gb.getStore().removeAll();
gt.selModel.selectFirstRow();
gt.setDisabled(recs.length == 0 && !o.params.query);
gb.setDisabled(recs.length == 0 && !o.params.query);
if (recs.length == 0 && o.params.query) {
cop.msg.alert("Es wurden keine zu Ihren Sucheingaben passenden Produkte gefunden.", "Bitte ändern Sie Ihre Suchparameter");
}
}
}
}
});
var refresher = new Ext.ux.grid.RowRefresh({
hideable: false,
listeners: {
refresh: function () {
var _sm = gridTop.getSelectionModel();
var rec = _sm.getSelected();
var _mapid = rec.get("map_id");
coprpc.getLists(
{
type: "mapstatus",
map_id: _mapid
},
{
success: function (res) {
var _ms = res.rows[0];
rec.set("price_min", _ms[2]);
rec.set("qty_status", _ms[1]);
rec.commit([true]);
}
}
);
}
}
});
var gB_expander = new Ext.ux.grid.RowExpander({
hideable: false,
getActiveType: function () {
//console.info('Expand Project');
// var tP = Ext.getCmp('gridBottomTabPanel');
//var AT = tP.getActiveTab();
//if(AT == 'vk'){
//return this.grid.topToolbar.getActiveTab().id.replace('_eq','');
var _id = this.grid.topToolbar.getActiveTab().id.split("_");
return _id[0];
},
renderer: function (v, p, record) {
var type = this.getActiveType();
return this["render_" + (this["render_" + type] ? type : "default")](v, p, record);
},
render_default: function (_v, p, _record) {
p.cellAttr = 'rowspan="2"';
return '
';
},
render_vk: function (v, p, record) {
if (!record.get("isSub") && record.get("calc_rowid")) {
return this.render_default(v, p, record);
} else {
return "";
}
},
getRowClass: function (record, rowIndex, p, ds) {
var type = this.getActiveType();
var _rc = [];
var _fc = record.get("frontend_cfg");
// debugger;
if (_fc.cc_contract === true && user_group == 5) {
_rc.push("cc_contract");
}
if (_fc.special && _fc.special.enabled === true) {
_rc.push("prod_special");
}
var c = record.get("loading");
if (c) {
_rc.push("x-item-loading");
}
// var _rowClass = (record.get('loading')) ? 'x-item-loading' : '';
return this["getRowClass_" + (this["getRowClass_" + type] ? type : "default")](record, rowIndex, p, ds) + " " + _rc.join(" ");
},
getRowClass_vk: function (record, _rowIndex, _p, _ds) {
if (record.get("isSub")) {
return "x-grid3-row-equipment";
} else if (record.get("calc_rowid") !== "") {
return "x-grid3-row-collapsed";
} else {
return "";
}
},
getRowClass_default: function (record, rowIndex, p, _ds) {
p.cols = p.cols - 1;
var content = this.bodyContent[record.id];
if (!content && !this.lazyRender) {
content = this.getBodyContent(record, rowIndex);
}
if (content) {
p.body = content;
}
if (!Ext.isEmpty(record.get("project_id")) && !Ext.isEmpty(record.get("project_id_ex"))) {
var _pcss = record.get("project_id") === record.get("project_id_ex") ? " ca-project" : "";
}
return this.state[record.id] ? "x-grid3-row-expanded" + _pcss : "x-grid3-row-collapsed" + _pcss;
},
tpl: new Ext.XTemplate(
'Projektinformationen
',
'
',
"Kunden Name | : | {cust_name} |
",
' Gültig bis | : | {[this.df(values.valid_until)]} |
',
"Verfügbare Stückzahl | : | {qty_left} |
",
"
",
{
df: function (v) {
return new Date(v * 1).format("d.m.Y");
}
}
),
expandRow: function (row) {
var type = this.getActiveType();
this["expandRow_" + (this["expandRow_" + type] ? type : "default")](row);
},
expandRow_default: function (_row) {},
expandRow_projects: function (row) {
if (typeof row == "number") {
row = this.grid.view.getRow(row);
}
var record = this.grid.store.getAt(row.rowIndex);
var body = Ext.DomQuery.selectNode("tr:nth(2) div.x-grid3-row-body", row);
if (this.beforeExpand(record, body, row.rowIndex)) {
this.state[record.id] = true;
Ext.fly(row).replaceClass("x-grid3-row-collapsed", "x-grid3-row-expanded");
this.fireEvent("expand", this, record, body, row.rowIndex);
}
},
expandRow_vk: function (row) {
if (!row.loading) {
row.loading = true;
if (typeof row == "number") {
row = this.grid.view.getRow(row);
}
this.record = this.grid.store.getAt(row.rowIndex);
if (!(!this.record.get("isSub") && this.record.get("calc_rowid"))) {
row.loading = false;
return;
}
var cm = this.grid.getColumnModel();
var exp = cm.getColumnById("expander");
var exp_idx = cm.config.indexOf(exp);
var cell = this.grid.view.getCell(row.rowIndex, exp_idx);
Ext.fly(cell).addClass("x-grid3-row-loading");
var rid = this.record.get("calc_rowid");
coprpc.getArticlesCalc(
{
rowid: rid
},
{
success: function (x, _y) {
ds = this.grid.store;
o = x;
if (o.rows.length > 0) {
var r = ds.reader.readRecords(o);
Ext.each(
r.records,
function (el, _idx, _arr) {
el.set("isSub", true);
el.set("master", this.record.get("calc_rowid"));
},
this
);
ds.insert(row.rowIndex + 1, r.records);
Ext.fly(row).replaceClass("x-grid3-row-collapsed", "x-grid3-row-expanded");
}
var cm = this.grid.getColumnModel();
var exp = cm.getColumnById("expander");
var exp_idx = cm.config.indexOf(exp);
var cell = this.grid.view.getCell(row.rowIndex, exp_idx);
Ext.fly(cell).removeClass("x-grid3-row-loading");
},
failure: function (_x, _y) {
var cm = this.grid.getColumnModel();
var exp = cm.getColumnById("expander");
var exp_idx = cm.config.indexOf(exp);
var cell = this.grid.view.getCell(row.rowIndex, exp_idx);
Ext.fly(cell).removeClass("x-grid3-row-loading");
},
scope: this
}
);
}
},
collapseRow: function (row) {
var type = this.getActiveType();
this["collapseRow_" + (this["collapseRow_" + type] ? type : "default")](row);
},
collapseRow_default: function (_row) {
// console.log('collapseRow_default');
},
collapseRow_projects: function (row) {
if (typeof row == "number") {
row = this.grid.view.getRow(row);
}
var record = this.grid.store.getAt(row.rowIndex);
var body = Ext.fly(row).child("tr:nth(1) div.x-grid3-row-body", true);
if (this.fireEvent("beforecollapse", this, record, body, row.rowIndex) !== false) {
this.state[record.id] = false;
Ext.fly(row).replaceClass("x-grid3-row-expanded", "x-grid3-row-collapsed");
this.fireEvent("collapse", this, record, body, row.rowIndex);
}
},
collapseRow_vk: function (row) {
if (typeof row == "number") {
row = this.grid.view.getRow(row);
}
this.record = this.grid.store.getAt(row.rowIndex);
ds = this.grid.store;
x = ds.queryBy(function (r, _id) {
if (r.get("isSub") === true && r.get("master") == this.record.get("calc_rowid")) {
return true;
}
return false;
}, this);
x.each(function (y, _z) {
ds.remove(y);
});
Ext.fly(row).replaceClass("x-grid3-row-expanded", "x-grid3-row-collapsed");
row.loading = false;
}
});
if (multilanguage) {
var _btnPD = {
iconCls: "icon-details",
text: "Produktdetails",
bname: "details",
width: 80,
split: true,
menu: {
items: [
{
text: "Fremdsprachen",
handler: function (b, _e) {
copdesk.loadStartModule("module_media", function (id) {
var pB = b.findParentByType("button");
if (!pB) {
pB = b.findParentByType("menuitem");
}
copdesk.getModule(id).createWindow(pB.mapid, true);
});
}
}
]
},
disabled: true,
handler: function (b, _e) {
copdesk.loadStartModule("module_media", function (id) {
copdesk.getModule(id).createWindow(b.mapid);
});
}
};
} else {
var _btnPD = {
iconCls: "icon-details",
text: "Produktdetails",
bname: "details",
width: 80,
disabled: true,
handler: function (b, _e) {
copdesk.loadStartModule("module_media", function (id) {
copdesk.getModule(id).createWindow(b.mapid);
});
}
};
}
var _btns = [
_btnPD,
{
iconCls: "ca-btn-html",
text: "Datenblatt",
bname: "html",
disabled: true,
width: 80,
handler: function (b, _e) {
showDatasheet(b.mapid, true);
}
},
{
iconCls: "ca-btn-pdf",
text: "PDF",
bname: "pdf",
disabled: true,
width: 80,
handler: function (b, _e) {
showPdf(b.mapid);
}
},
{
text: "Produktvergleich",
scope: this,
iconCls: "icon-compare",
bname: "compare",
disabled: true,
handler: function (b, _e) {
copdesk.loadStartModule(
"module_comparison",
function (id) {
var x = [];
var y = [];
Ext.each(b.mapid, function (o, _i) {
if (o.get("sheet_cnet") == 1) {
x.push(o.get("map_id"));
} else {
y.push(o.get("map_id"));
}
});
if (y.length > 0) {
cop.msg.alert(
"",
"Map ID" +
(y.length == 1 ? "" : "s") +
" (" +
y.join(", ") +
") " +
(y.length == 1 ? "hat" : "haben") +
" keine Content-Daten zum vergleichen!"
);
}
if (x.length > 0) {
copdesk.getModule(id).createWindow(x);
}
}.createDelegate(this.ownerCt)
);
}
},
"-",
{
text: "Merkliste",
iconCls: "icon-note",
bname: "note",
scope: this,
width: 80,
disabled: true,
handler: function (b, _e) {
copdesk.loadStartModule("module_note", function (id) {
var x = [];
Ext.each(
b.mapid,
function (o, _i) {
var item = {
map_id: o.get("map_id"),
prod_type: o.get("prod_type"),
desc_short: o.get("desc_short"),
item_qty: 1,
price_min: o.get("price_min"),
isNew: true
};
x.push(item);
},
x
);
copdesk.getModule(id).createWindow({
records: x
});
});
}
},
"-",
{
text: "Feedback",
iconCls: "icon-proposal",
bname: "sendFeedback",
scope: this,
width: 80,
disabled: true,
handler: function (b, _e) {
copdesk.loadStartModule("module_feedback", function (id) {
var x = [];
Ext.each(
b.mapid,
function (o, _i) {
x.push(o.data);
},
x
);
copdesk.getModule(id).createWindow({
records: x
});
});
}
},
{
text: "An mention übertragen",
iconCls: "icon-mention",
bname: "sendMention",
scope: this,
width: 80,
disabled: true,
hidden: !!!isMentionUser,
handler: function (b, _e) {
Ext.each(b.mapid, function (o, _i) {
document.location = "vfps:C1P" + o.get("map_id");
});
}
},
{
text: "An Dynamics übertragen",
iconCls: "icon-dynamics",
bname: "sendDynamics",
scope: this,
width: 80,
disabled: true,
hidden: !!!isDynamicsUser,
handler: function (b, _e) {
Ext.each(b.mapid, function (o, _i) {
document.location = "DynNavCop:mapid=" + o.get("map_id");
});
}
},
{
text: "An SAP übertragen",
iconCls: "icon-sap",
bname: "sendSAP",
scope: this,
width: 80,
disabled: true,
hidden: !!!isSAPUser,
handler: function (b, _e) {
try {
if (typeof window.external.ImportArticleToSAP != "undefined") {
var mids = [];
for (var i = 0; i < b.mapid.length; i++) {
mids.push(b.mapid[i].get("map_id"));
}
window.external.ImportArticleToSAP(mids.join(","));
}
} catch (e) {}
}
},
{
text: "An SelectLine übertragen",
iconCls: "icon-saelker",
bname: "sendSaelker",
scope: this,
width: 80,
disabled: true,
hidden: !!!isSelectLineUser,
handler: function (b, _e) {
var x = [];
Ext.each(
b.mapid,
function (o, _i) {
x.push(o.get("map_id"));
},
x
);
document.location =
"slcop://mapid=" +
x.join(",") +
(copquery.belegtyp ? "&belegtyp=" + copquery.belegtyp : "") +
(copquery.belegnummer ? "&belegnummer=" + copquery.belegnummer : "");
}
},
{
text: "An SAP Buisness ONE übertragen",
iconCls: "icon-sap",
bname: "sendSAP",
scope: this,
width: 80,
disabled: true,
hidden: !!!isSAPOneUser,
handler: function (b, e) {
var x = [];
Ext.each(
b.mapid,
function (o, i) {
x.push(o.get("map_id"));
},
x
);
document.location = "sap.nag.apa://QuickOpen?Product?" + x.join(",");
}
},
{
text: "An cop ERP übertragen",
iconCls: "icon-microtech",
bname: "sendMicrotech",
scope: this,
width: 80,
disabled: true,
hidden: !!!isMicrotechUser,
handler: function (b, _e) {
document.location = "copcreate://" + b.mapid + "/";
}
},
{
text: "An Lexware übertragen",
iconCls: "icon-lexware",
bname: "sendLexware",
scope: this,
width: 80,
disabled: true,
hidden: !!!isLexwareUser,
handler: function (b, _e) {
var x = [];
Ext.each(
b.mapid,
function (o, _i) {
x.push(o.get("map_id"));
},
x
);
if (x.length == 1) {
document.location = "ioviscop://Product/?id=" + x.join(",");
} else {
document.location = "ioviscop://ProductList/?Products=" + x.join(",");
}
}
},
{
text: "An Concept Office übertragen",
iconCls: "icon-conceptOffice",
bname: "sendCO",
scope: this,
width: 80,
disabled: true,
hidden: !!!isCOUser,
handler: function (b, _e) {
var x = [];
Ext.each(
b.mapid,
function (o, _i) {
x.push(o.get("map_id"));
},
x
);
document.location = "cocallback:" + (copquery.co_id ? copquery.co_id : "0-0") + "?article?" + x.join(",");
}
},
{
text: "In Beleg übertragen",
iconCls: "icon-autoTask",
bname: "sendAT",
scope: this,
width: 80,
split: true,
disabled: true,
hidden: !!!isAutotaskUser,
handler: function (b, _e) {
if (copquery.atmodule != undefined) {
var x = [];
Ext.each(b.mapid, function (o, _i) {
x.push({
map_id: o.get("map_id"),
man_name: o.get("man_name")
});
});
cop.erp.autotask.sendToAT(x, copquery, "beleg");
} else {
cop.msg.error({
code: "404",
message: "Es konnte kein Beleg ermittelt werden",
description: ""
});
}
},
menu: {
items: [
{
text: "An AutoTask übertragen",
iconCls: "icon-autoTask",
scope: this,
disabled: false,
handler: function (b, _e) {
var x = [];
Ext.each(b.parentMenu.ownerCt.mapid, function (o, _i) {
x.push({
map_id: o.get("map_id"),
man_name: o.get("man_name")
});
});
cop.erp.autotask.sendToAT(x);
}
}
]
}
},
{
text: "An weclapp übertragen",
iconCls: "icon-weclapp",
bname: "sendWC",
hidden: !!!isWeClappUser,
scope: this,
disabled: false,
handler: function (b, _e) {
var x = [];
Ext.each(b.mapid, function (o, _i) {
x.push({ map_id: o.get("map_id"), man_name: o.get("man_name") });
});
var selectedProdID = null;
if (x.length === 1) {
var gridBottom = Ext.getCmp("ms_gB");
var selectedRow = gridBottom.getSelectionModel().getSelected();
if (selectedRow) {
selectedProdID = selectedRow.get("prod_id");
}
}
cop.erp.weclapp.sendToWc(x, selectedProdID);
}
},
{
text: "An BüroWARE übertragen",
iconCls: "icon-bueroware",
bname: "sendBW",
scope: this,
width: 80,
disabled: true,
hidden: !!!isBWUser,
handler: function (b, _e) {
var x = [];
Ext.each(b.mapid, function (o, _i) {
x.push(o.get("map_id"));
});
document.location = "copbw://mapid=" + x.join(",");
}
}
];
var gridTop = new Ext.grid.GridPanel({
id: win_id + "-gridTop",
loadMask: true,
autoExpandColumn: "desc_short",
autoExpandMax: 4000,
border: true,
region: "center",
//disabled:true,
//stdSearch: stdSearch,
//profiSearch: profiSearch,
ds: dsMain,
//plugins: expander,
tbar: [
"Suche:",
new cop.search.field({
id: win_id + "-search",
width: 400,
onTrigger2Click: function () {
this.hasSearch = true;
this.triggers[0].show();
this.fireEvent("execSearch", this);
},
listeners: {
clearSearch: function () {
var _s = Ext.StoreMgr.get(win_id + "-dsMain");
var _params = {
query: ""
};
_s.clearFilter();
_s.load({ params: _params });
},
execSearch: function () {
if (this.getRawValue()) {
var _s = Ext.StoreMgr.get(win_id + "-dsMain");
var _params = {
query: this.getRawValue()
};
_s.load({ params: _params });
}
}
}
})
],
cm: new Ext.grid.ColumnModel({
defaults: {
sortable: true,
width: 120
},
columns: [
//expander,
{
header: " ",
id: "classBookmark",
dataIndex: "bookmark",
width: 20,
sortable: false,
menuDisabled: true,
align: "right",
renderer: cop.util.Format.bookmark,
cellClick: function (rec, _e) {
coprpc.toggleBookmark(
{
mapid: rec.get("map_id"),
bookmark: rec.get("bookmark") * 1
},
{
success: function (r, _t) {
var rec = this;
rec.set("bookmark", r.bookmark);
rec.commit();
},
scope: rec
}
);
}
},
cop.util.Columns.MapId,
cop.util.Columns.changeColumn(cop.util.Columns.ManufacturerName, { width: null }),
cop.util.Columns.DescShort,
cop.util.Columns.ProdType,
cop.util.Columns.Picture,
cop.util.Columns.Datasheet,
cop.util.Columns.changeColumn(cop.util.Columns.ManufacturerArticleNumber, { width: null }),
cop.util.Columns.EAN,
cop.util.Columns.changeColumn(cop.util.Columns.HEKNetto, { renderer: Ext.util.Format.numberRenderer("0.000,00/i"), dataIndex: "price_min" }),
cop.util.Columns.HEKNettoMinAvail,
cop.util.Columns.changeColumn(cop.util.Columns.EVPNetto, { hidden: false }),
cop.util.Columns.changeColumn(cop.util.Columns.QuantityStatus, { width: 25, sortable: false }),
/*Verkaufspreisanzeige*/
cop.util.Columns.changeColumn(cop.util.Columns.VKNetto, { dataIndex: "vk", width: 80 }),
cop.util.Columns.changeColumn(cop.util.Columns.VKBrutto, { width: 80 }),
cop.util.Columns.PID,
cop.util.Columns.ProjectPrice
]
}),
viewConfig: {
templates: {
cell: new Ext.Template(
'',
' {value} ',
" | "
)
},
getRowClass: function (record, _index) {
var c = record.get("hasEq");
if (c === 2) {
return "x-grid3-row-follower";
} else if (c === 1) {
return "x-grid3-row-hasEquipment";
}
}
},
/*
tbar: new Ext.Panel({
border: true,
bodyStyle: "border-bottom:0px;",
//items: [profiSearch, stdSearch]
}),
*/
listeners: {
cellclick: function (grid, rowIndex, columnIndex, e) {
var record = grid.getStore().getAt(rowIndex);
var cfg = grid.getColumnModel().config[columnIndex];
if (cfg.cellClick) {
cfg.cellClick.call(this, record, e);
return;
}
},
rowcontextmenu: function (grid, rowIdx, e) {
e.stopEvent();
if (e.shiftKey) {
var r = grid.getSelectionModel().getSelected();
grid.getSelectionModel().selectRange(r.store.indexOf(r), rowIdx, true);
} else {
grid.getSelectionModel().selectRow(rowIdx, e.ctrlKey);
}
grid.contextMenu.recs = grid.getSelectionModel().getSelections();
// Ext.DomQuery.jsSelect(".copy-button")
if (grid.contextMenu.recs.length > 0) {
grid.contextMenu.showAt(e.getXY());
// var client = new ZeroClipboard(grid.contextMenu.items.items[6].getEl().dom);
// var d = grid.contextMenu.recs;
// debugger;
// client.on( "copy", function (event) {
// var clipboard = event.clipboardData;
// clipboard.setData( "text/plain", "Copy me!" );
// clipboard.setData( "text/html", "Copy me!" );
// clipboard.setData( "application/rtf", "{\\rtf1\\ansi\n{\\b Copy me!}}" );
// });
}
},
beforestaterestore: function (grid, state) {
if (state.columns.length != grid.getColumnModel().columns.length) {
return false;
}
}
},
contextMenu: new Ext.menu.Menu({
id: win_id + "-context",
items: _btns //.concat({text:'Kopieren',cls:'ca-copy-item'})
}),
bbar: new Ext.ux.PagingToolbar({
pageSize: 50,
store: Ext.StoreMgr.get(this.moduleId + "-dsMain"),
prependButtons: true,
displayInfo: true,
enableOverflow: true,
id: win_id + "-bbar",
items: _btns.concat(["->", { text: " ", xtype: "tbtext", id: win_id + "-searchDuration" }])
}),
selModel: new Ext.grid.RowSelectionModel({
listeners: {
rowselect: {
fn: function (sm, _rowIdx, r) {
var art_sup = Ext.StoreMgr.get(win_id + "-dsDetail");
gridBottom.getStore().remoteSort = true;
var _params = { map_id: r.data.map_id };
if (r.data.project_id) {
_params.project_id_ex = r.data.project_id;
}
art_sup.load({
params: _params,
callback: function (_r, _o, _s) {
var tP = Ext.getCmp(win_id + "-gridBottomTabPanel");
var AT = tP.getActiveTab();
var hasE = this.query("tab", "extended").getCount() > 0;
var hasM = this.query("tab", "main").getCount() > 0;
var hasVK =
this.queryBy(function (rec, _id) {
if (rec.get("vk_netto")) {
return true;
}
}).getCount() > 0;
var hasProj =
this.queryBy(function (rec, _id) {
if (rec.get("project_id")) {
return true;
}
}).getCount() > 0;
if (AT.id == "vk_eq" || AT.id == "projects_eq") {
} else if (hasM) {
tP.setActiveTab("main_eq");
} else if (hasE) {
tP.setActiveTab("extended_eq");
}
tP.getItem("main_eq").setDisabled(!hasM);
tP.getItem("extended_eq").setDisabled(!hasE);
tP.getItem("vk_eq").setDisabled(!hasVK);
tP.getItem("projects_eq").setDisabled(!hasProj);
}
});
var _fn = function (item, _index, _length) {
if (item.bname !== "") {
if (_niA.indexOf(item.bname) > -1) {
item.setDisabled(_noItem);
}
if (_nCA.indexOf(item.bname) > -1) {
item.setDisabled(_noCM);
}
if (_No.indexOf(item.bname) > -1) {
item.setDisabled(mids.length > 1);
}
if (_nCAs.indexOf(item.bname) > -1) {
item.setDisabled(_noCMs);
}
if (_MMID.indexOf(item.bname) > -1) {
item.mapid = mids;
} else {
item.mapid = mid;
}
}
};
var _bbar = Ext.getCmp(win_id + "-bbar");
var _context = Ext.getCmp(win_id + "-context");
var _noItem = !(r.get("map_id") > 0);
var _noCMs = r.get("sheet_cnet") != 1;
var _sel = sm.getSelections();
var _noCM =
Ext.each(_sel, function (item, _idx, _all) {
return !(item.get("sheet_cnet") == 1);
}) === undefined;
// debugger;
var _niA = [
"details",
"note",
"pdf",
"html",
"compare",
"sendFeedback",
"sendMention",
"sendDynamics",
"sendSAP",
"sendSaelker",
"sendMicrotech",
"sendLexware",
"sendCO",
"sendAT",
"sendWC",
"sendBW"
];
var _nCAs = ["html", "pdf"];
var _nCA = ["compare"];
var _No = ["html", "pdf", "details"];
var _MMID = [
"compare",
"sendMention",
"sendDynamics",
"sendSAP",
"note",
"sendFeedback",
"sendSaelker",
"sendLexware",
"sendCO",
"sendAT",
"sendWC",
"sendBW"
];
var mid = r.get("map_id");
var mids = _sel;
_bbar.items.each(_fn);
_context.items.each(_fn);
if (_bbar.layout.moreMenu && _bbar.layout.moreMenu.items) {
_bbar.layout.moreMenu.items.each(_fn);
}
var _awin_id = copdesk.desktop.taskbar.tbPanel.activeButton.win.id;
if (win.id == _awin_id || _awin_id == "module_media" || _awin_id == "module_sheet") {
var mM = copdesk.getModule("module_media");
if (Ext.getCmp("module_media")) {
copdesk.getModule("module_media").createWindow(r.data.map_id, 2);
}
if (Ext.getCmp("module_sheet")) {
showDatasheet(r.data.map_id);
}
}
},
buffer: 50
},
rowdeselect: function (sm, _rowIdx, r) {
var _fn = function (item, _index, _length) {
if (item.bname !== "") {
if (_niA.indexOf(item.bname) > -1) {
item.setDisabled(_noItem);
}
if (_nCA.indexOf(item.bname) > -1) {
item.setDisabled(_noCM);
}
if (_nCAs.indexOf(item.bname) > -1) {
item.setDisabled(_noCMs);
}
if (_No.indexOf(item.bname) > -1) {
item.setDisabled(true);
}
if (_MMID.indexOf(item.bname) > -1) {
item.mapid = mids;
} else {
item.mapid = mid;
}
}
};
var _bbar = Ext.getCmp(win_id + "-bbar");
var _context = Ext.getCmp(win_id + "-context");
var _sel = sm.getSelections();
var _noItem = _sel.length === 0;
var _noCMs = r.get("sheet_cnet") != 1;
var _noCM =
Ext.each(_sel, function (item, _idx, _all) {
return !(item.get("sheet_cnet") == 1);
}) === undefined;
var _niA = [
"details",
"note",
"pdf",
"html",
"compare",
"sendFeedback",
"sendSaelker",
"sendMicrotech",
"sendLexware",
"sendCO",
"sendAT",
"sendWC",
"sendBW"
];
var _nCAs = ["html", "pdf"];
var _nCA = ["compare"];
var _No = ["html", "pdf", "details"];
var _MMID = ["compare", "note", "sendFeedback", "sendSaelker", "sendLexware", "sendCO", "sendAT", "sendWC", "sendBW"];
var mid = r.get("map_id");
var mids = _sel;
_bbar.items.each(_fn);
_context.items.each(_fn);
if (_bbar.layout.moreMenu && _bbar.layout.moreMenu.items) {
_bbar.layout.moreMenu.items.each(_fn);
}
}
}
})
});
var gBcmMain = [
cop.util.Columns.OrderAddButton,
cop.util.Columns.ProductQualityDesc,
cop.util.Columns.ProductPackaging,
cop.util.Columns.Supplier,
cop.util.Columns.SupplierOptionLink,
cop.util.Columns.ArtikelNumber,
cop.util.Columns.ProductQualityHidden,
cop.util.Columns.SupplierNote,
cop.util.Columns.DescShort,
cop.util.Columns.PromoText,
cop.util.Columns.NewArticle,
cop.util.Columns.HEKNetto,
cop.util.Columns.PriceCalc,
cop.util.Columns.TimeStamp,
cop.util.Columns.QuantityStatus,
cop.util.Columns.QuantityReal,
cop.util.Columns.StorageLocation,
cop.util.Columns.ETA,
cop.util.Columns.VKNetto,
cop.util.Columns.VKBrutto,
refresher
];
var gBcmVK = [
gB_expander,
cop.util.Columns.Supplier,
cop.util.Columns.ArtikelNumber,
cop.util.Columns.SupplierNote,
cop.util.Columns.DescShort,
cop.util.Columns.PriceCalc,
cop.util.Columns.HEKNetto,
cop.util.Columns.TimeStamp,
cop.util.Columns.StorageLocation,
cop.util.Columns.QuantityStatus,
cop.util.Columns.QuantityReal,
cop.util.Columns.ETA,
cop.util.Columns.Calculation,
cop.util.Columns.changeColumn(cop.util.Columns.VKNetto, { width: 80 }),
cop.util.Columns.changeColumn(cop.util.Columns.VKBrutto, { width: 80 }),
cop.util.Columns.changeColumn(cop.util.Columns.Marge, { width: 80 })
];
var gBcmProjects = [
gB_expander,
cop.util.Columns.OrderAddButton,
cop.util.Columns.Supplier,
cop.util.Columns.ArtikelNumber,
cop.util.Columns.SupplierNote,
cop.util.Columns.DescShort,
cop.util.Columns.changeColumn(cop.util.Columns.HEKNetto, { renderer: cop.util.Format.project_price, dataIndex: "project_price" }),
cop.util.Columns.ProjectTimestamp,
cop.util.Columns.QuantityStatus,
cop.util.Columns.QuantityReal,
cop.util.Columns.ETA,
cop.util.Columns.ProjectId,
cop.util.Columns.ProjectCustomer
];
var gBcmStreetPrice = [
{
header: " ",
btnType: "btnStreetPrice",
renderer: cop.util.Format.renderBtnExStreetPrice,
width: 60,
hideable: false,
cellClick: cop.util.streetClick,
tooltip: "Zur Webseite des Anbieters"
},
{
sortable: true,
header: "Anbieter",
dataIndex: "sup_name",
renderer: cop.util.Format.supplier,
tooltip: "Webseite des Anbieters"
},
{
sortable: true,
header: "Artikelbezeichnung",
dataIndex: "desc_short",
renderer: cop.util.Format.qtip,
width: null,
id: "desc_short"
},
{
sortable: true,
header: "Preis Netto",
dataIndex: "price_amount",
renderer: function (_val, _meta, record) {
var hek = record.get("price_amount");
// Mehrwertsteuer von 01.07.2020 - 31.12.2020 auf 16 % gesenkt
if (Date.now() > 1593554400000 && Date.now() < 1609455600000) return Ext.util.Format.number(hek / 1.16, "0,00/i");
else return Ext.util.Format.number(hek / 1.19, "0,00/i");
},
cellClick: cop.util.priceClick,
align: "right",
width: 80
},
{
sortable: true,
header: "Preis Brutto",
dataIndex: "price_amount",
renderer: cop.util.Format.price_amount,
cellClick: cop.util.priceClick,
align: "right",
width: 80
}
];
var gBcmPriceHistory = [
{
sortable: false,
header: "Günstigster Lieferant",
dataIndex: "sup_name",
renderer: cop.util.Format.supplier,
width: 120
},
{
sortable: false,
header: "Artikelbezeichnung",
dataIndex: "desc_short",
width: null,
id: "desc_short"
},
{
sortable: false,
header: "Menge Bestpreis",
dataIndex: "best_qty",
// renderer: cop.util.Format.best_qty,
width: 120
},
{
sortable: false,
header: "Bestpreis",
dataIndex: "min_price",
renderer: cop.util.Format.price_amount,
width: 120
},
{
sortable: false,
header: "Maximalpreis",
dataIndex: "max_price",
renderer: cop.util.Format.price_amount,
width: 120
},
{
sortable: false,
header: "Ø Durchschnittspreis",
dataIndex: "avg_price",
renderer: cop.util.Format.price_amount,
width: 120
}
];
var gridBottom = new Ext.grid.GridPanel({
view: cop.util.gridBottomView(),
listeners: {
cellclick: cop.util.onCellClick,
beforerender: function (grid) {
var _cm = grid.getColumnModel();
_cm.getColumnById("gBodBtn").width = 60;
_cm.getColumnById("refresh").width = 33;
},
beforestatesave: function (grid, _state) {
var tp = Ext.getCmp(win_id + "-gridBottomTabPanel");
if (["main_eq", "extended_eq"].indexOf(tp.activeTab.id) == -1) {
grid.stateId = "ms_gB_" + tp.activeTab.id;
} else {
grid.stateId = "ms_gB";
}
return true;
},
beforestaterestore: function (grid, state) {
if (state.columns.length != grid.getColumnModel().columns.length) {
return false;
}
}
},
id: win_id + "-ms_gB",
stateId: win_id + "-ms_gB",
region: "south",
border: true,
height: 250,
split: true,
//disabled:true,
//title : 'default',
loadMask: true,
stateful: true,
autoExpandColumn: "desc_short",
autoExpandMax: 4000,
plugins: [refresher, gB_expander],
enableHdMenu: true,
tbar: new Ext.TabPanel({
id: win_id + "-gridBottomTabPanel",
minTabWidth: 115,
tabWidth: 135,
enableTabScroll: true,
height: 0,
activeTab: 0,
//border:false,
bodyStyle: "border-bottom-style:none;",
defaults: {
autoScroll: true,
border: false
},
items: [
{
title: "Standard",
id: "main_eq"
},
{
title: "Weitere",
id: "extended_eq"
},
{
title: "Verkauf",
id: "vk_eq"
},
{
title: "Projekte",
id: "projects_eq"
},
{
title: "Preisportal",
id: "streetPrice_eq"
},
{
title: "CG Bestpreis",
id: "pricehistory_eq"
}
],
listeners: {
afterrender: function (tabPanel) {
tabPanel.hideTabStripItem(4); //streetprice
tabPanel.hideTabStripItem(5); //pricehistory
tabPanel.hideTabStripItem(3); //projects
coprpc.checkModule(
{
groupModule: true,
moduleId: 14 //'projects'
},
function (o, _t) {
if (o && o.success) {
tabPanel.unhideTabStripItem(3);
}
}
);
if (user_group != 95 && user_group != 98) {
// tabPanel.unhideTabStripItem(4);
coprpc.checkModule(
{
groupModule: true,
moduleId: 16 //'streetprice'
},
function (o, _t) {
if (o && o.success) {
tabPanel.unhideTabStripItem(4);
}
}
);
}
if ([5, 50].indexOf(user_group) != -1) {
coprpc.checkModule(
{
groupModule: true,
moduleId: 17 //'pricehistory'
},
function (o, _t) {
if (o && o.success) {
tabPanel.unhideTabStripItem(5);
}
}
);
}
},
tabchange: function (_tab, panel) {
var cm = gridBottom.getColumnModel();
var _store = gridBottom.getStore();
if (_store.remoteSort === false) {
_store.remoteSort = true;
_store.sort(_store.sortInfo.field, _store.sortInfo.direction);
}
var x = gridBottom.getStore().queryBy(function (r, _id) {
if (r.get("isSub") === true) {
return true;
}
return false;
}, this);
x.each(function (y, _z) {
gridBottom.getStore().remove(y);
});
switch (panel.id) {
case "main_eq":
gridBottom.view.enableGrouping = true;
cm.setConfig(gridBottom.colsMain);
gridBottom.getStore().filterBy(function (rec, _id) {
if (rec.data.tab == "main") {
return true;
}
});
break;
case "extended_eq":
gridBottom.view.enableGrouping = true;
cm.setConfig(gridBottom.colsMain);
gridBottom.getStore().filterBy(function (rec, _id) {
if (rec.data.tab == "extended") {
return true;
}
});
break;
case "vk_eq":
gridBottom.view.enableGrouping = false;
cm.setConfig(gridBottom.colsVkView);
gridBottom.getStore().filterBy(function (rec, _id) {
if (rec.data.tab == "calc") {
return true;
}
});
break;
case "projects_eq":
gridBottom.view.enableGrouping = false;
cm.setConfig(gridBottom.colsProjectsView);
gridBottom.getStore().filterBy(function (rec, _id) {
if (rec.data.tab == "project") {
return true;
}
});
break;
case "pricehistory_eq":
gridBottom.view.enableGrouping = false;
gridBottom.loadMask.show();
gridBottom.getStore().filterBy(function (rec, _id) {
if (rec.data.tab == "leerLoading") {
return true;
}
});
cm.setConfig(gridBottom.colsPriceHistory);
var store = gridBottom.getStore();
var _old_recs = store.query("tab", "pricehistory");
store.remove(_old_recs.items);
var mid = gridTop.getSelectionModel().getSelected().get("map_id");
coprpc.getPriceHistory({ map_id: mid }, function (r) {
_r = [];
for (var rowIdx = 0; rowIdx < r.rows.length; rowIdx++) {
var element = r.rows[rowIdx];
var elArr = [];
elArr[0] = element.distributor;
elArr[2] = element.desc_short;
elArr[16] = "pricehistory";
elArr[41] = element.min_price;
elArr[42] = element.max_price;
elArr[43] = element.avg_price;
elArr[44] = element.best_qty;
elArr[49] = element.user_name;
elArr[32] = element.project_id;
_r.push(elArr);
}
store.loadData({ rows: _r }, true);
store.filterBy(function (rec, _id) {
if (rec.data.tab == "pricehistory") {
return true;
}
});
});
break;
case "streetPrice_eq":
gridBottom.view.enableGrouping = false;
if (typeof gridTop.getSelectionModel().getSelected() === "undefined") {
return;
}
gridBottom.loadMask.show();
gridBottom.getStore().filterBy(function (rec, _id) {
if (rec.data.tab == "leerLoading") {
return true;
}
});
// debugger;
// alert('loading');
var mid = gridTop.getSelectionModel().getSelected().get("map_id");
gridBottom.loadMask.show();
cm.setConfig(gridBottom.colsStreetPrice);
coprpc.getStreetPrice({ map_id: mid }, function (r) {
var store = gridBottom.getStore();
store.remoteSort = false;
//get records with streetPrice store.query('tab','streetPrice')
//remove records store.remove(recs)
var _old_recs = store.query("tab", "streetPrice");
store.remove(_old_recs.items);
var recs = [];
for (var i = 0; i < r.rows.length; i++) {
var _item = r.rows[i];
var _rec = [];
_rec[0] = _item.site;
_rec[2] = _item.title;
_rec[16] = "streetPrice";
_rec[5] = _item.price;
_rec[33] = _item.link;
recs.push(_rec);
//recs.sort([3]); //Sortierung funktioniert nach Anbieter
}
store.loadData({ rows: recs }, true);
// store.multiSort([{ field: 'product_quality', direction: 'ASC' }, { field: store.sortInfo.field }], store.sortInfo.direction);
store.sort(store.sortInfo.field, store.sortInfo.direction);
gridBottom.loadMask.hide();
gridBottom.getStore().filterBy(function (rec, _id) {
if (rec.data.tab == "streetPrice") {
return true;
}
});
});
break;
}
if (["main", "extended"].indexOf(panel.id) === -1) {
var _state = Ext.state.Manager.get("ms_gB_" + panel.id);
if (_state) {
gridBottom.applyState(_state);
}
}
}
}
}),
cls: "ca-supplierGrid",
viewConfig: {
templates: {
cell: new Ext.Template(
'',
"{img}",
' {value} ',
" | "
)
}
},
ds: new Ext.data.DirectStore({
getGroupState: function () {
return this.groupOnSort && this.groupField !== false ? (this.sortInfo ? this.sortInfo.field : undefined) : this.groupField;
},
groupField: "product_quality_and_package", // nur bei den Tabs Standard und Weitere ist dies relevant
directFn: coprpc.getArticlesSupplier,
id: win_id + "-dsDetail",
remoteSort: true,
root: "rows",
totalProperty: "results",
listeners: {
load: function (_store, _records, _options) {
var panel = Ext.getCmp(win_id + "-gridBottomTabPanel").getActiveTab();
var cm = gridBottom.getColumnModel();
switch (panel.id) {
case "main_eq":
cm.setConfig(gridBottom.colsMain);
gridBottom.getStore().filterBy(function (rec, _id) {
if (rec.data.tab == "main") {
return true;
}
});
break;
case "extended_eq":
cm.setConfig(gridBottom.colsMain);
gridBottom.getStore().filterBy(function (rec, _id) {
if (rec.data.tab == "extended") {
return true;
}
});
break;
case "vk_eq":
cm.setConfig(gridBottom.colsVkView);
gridBottom.getStore().filterBy(function (rec, _id) {
if (rec.data.tab == "calc") {
return true;
}
});
break;
case "projects_eq":
cm.setConfig(gridBottom.colsProjectsView);
gridBottom.getStore().filterBy(function (rec, _id) {
if (rec.data.tab == "project") {
return true;
}
});
break;
case "streetPrice_eq":
cm.setConfig(gridBottom.colsStreetPrice);
gridBottom.getStore().filterBy(function (rec, _id) {
if (rec.data.tab == "streetPrice") {
return true;
}
});
break;
case "pricehistory_eq":
cm.setConfig(gridBottom.colsPriceHistory);
gridBottom.getStore().filterBy(function (rec, _id) {
if (rec.data.tab == "pricehistory") {
return true;
}
});
break;
}
}
},
sortInfo: {
field: "price_amount",
direction: "ASC"
},
fields: [
{ name: "sup_name", mapping: 0 },
{ name: "sup_aid", mapping: 1 },
{ name: "desc_short", mapping: 2 },
{ name: "prod_promo", mapping: 3 },
{ name: "prod_new", mapping: 4 },
{ name: "price_amount", mapping: 5 },
{ name: "qty_ts", mapping: 6 },
{ name: "qty_status", mapping: 7 },
{ name: "qty_real", mapping: 8 },
{ name: "prod_id", mapping: 9 },
{ name: "prod_promo_desc", mapping: 10 },
{ name: "prod_promo_date", mapping: 11 },
{ name: "pr_ts", mapping: 12 },
{ name: "eta", mapping: 13 },
{ name: "mult_qty", mapping: 14 },
{ name: "sup_oc", mapping: 15 },
{ name: "tab", mapping: 16 },
{ name: "bonus", mapping: 17 },
{ name: "discount", mapping: 18 },
{ name: "status", mapping: 19 },
{ name: "supmsg", mapping: 20 },
{ name: "orders", mapping: 21 },
{ name: "qty_obj", mapping: 22 },
{ name: "pr_obj", mapping: 23 },
{ name: "ship_obj", mapping: 24 },
{ name: "calc_rowid", mapping: 25 },
{ name: "calc_name", mapping: 26 },
{ name: "vk_netto", mapping: 27 },
{ name: "vk_brutto", mapping: 28 },
{ name: "frontup", mapping: 29 },
{ name: "no_cancel", mapping: 30 },
{ name: "no_return", mapping: 31 },
{ name: "project_id", mapping: 32 },
{ name: "project_price", mapping: 33 },
{ name: "cust_name", mapping: 34 },
{ name: "cust_data", mapping: 35 },
{ name: "project_data", mapping: 36 },
{ name: "valid_until", mapping: 37 },
{ name: "qty_left", mapping: 38 },
{ name: "pj_ts", mapping: 39 },
{ name: "frontend_cfg", mapping: 40 },
{ name: "min_price", mapping: 41 },
{ name: "max_price", mapping: 42 },
{ name: "avg_price", mapping: 43 },
{ name: "best_qty", mapping: 44 },
{ name: "link_special", mapping: 45 },
{ name: "product_quality", mapping: 47 },
{ name: "product_quality_desc", mapping: 48 },
{ name: "product_package", mapping: 49 },
{
name: "product_quality_and_package",
mapping: function (value) {
// Feld zum Gruppieren nach quality und anschließend nach package
return (value[47] * 1 + "." + value[49] * 1) * 1;
}
},
{ name: "prod_type", mapping: 50 },
{ name: "project_id_ex", mapping: 51 },
{ name: "price_user_info", mapping: 52 }
]
}),
cm: new Ext.grid.ColumnModel({
defaultSortable: false,
columns: gBcmMain
}),
colsMain: gBcmMain,
colsVkView: gBcmVK,
colsProjectsView: gBcmProjects,
colsStreetPrice: gBcmStreetPrice,
colsPriceHistory: gBcmPriceHistory
});
var lay = this.getWinLayout();
win = desktop.createWindow({
id: win_id,
iconCls: "icon-equipment",
title: cop.lang.title_module_equipment,
width: lay.width,
height: lay.height,
x: lay.left,
y: lay.top,
maximized: lay.max,
minWidth: 840,
minHeight: 550,
taskHidden: false,
border: false,
layout: "border",
items: [
{
region: "center",
layout: "border",
border: false,
items: [gridTop, gridBottom]
}
],
listeners: {
activate: function (_win) {
var _sm = gridTop.getSelectionModel();
var rec = _sm.getSelected();
//_sm.clearSelections();
//_sm.selectRecords([rec]);
if (Ext.getCmp("module_media") && rec) {
copdesk.getModule("module_media").createWindow(rec.data.map_id, 2);
}
if (Ext.getCmp("module_sheet") && rec) {
if (!Ext.getCmp("module_sheet").hidden) {
showDatasheet(rec.data.map_id);
}
}
}
}
});
win.show();
checkMaxMode(win);
}
Ext.StoreMgr.get(win_id + "-dsMain").removeAll();
Ext.StoreMgr.get(win_id + "-dsMain").clearFilter();
Ext.StoreMgr.get(win_id + "-dsDetail").removeAll();
with (Ext.getCmp(win_id + "-search")) {
el.dom.value = "";
triggers[0].hide();
hasSearch = false;
}
var tP = Ext.getCmp(win_id + "-gridBottomTabPanel");
if (project_id) {
tP.setActiveTab("projects_eq");
}
if (mapid) {
Ext.StoreMgr.get(win_id + "-dsMain").load({
params: {
mapid: mapid,
project_id: project_id
}
});
}
win.show();
}
});
copdesk.module_configPrinterCare = Ext.extend(Ext.app.Module, {
moduleId: "module_configPrinterCare",
autostart: false,
preload: false,
init: function () {}
});
copdesk.module_notelist = Ext.extend(Ext.app.Module, {
moduleId: "module_notelist",
autostart: false,
preload: false,
init: function () {
this.launcher = {
text: cop.lang.title_module_notelist,
iconCls: "icon-note",
scope: this,
menuPos: 30
};
}
});
feat_search=true
copmedia_version='basic'
multilanguage=false
mod_exports=[]
mod_suppliers=[1,2,3,7,9,12,19,23,24,27,28,31,44,50,51,55,57,65,81,137,139,179,186,233,249,269,300,313,315,320,329,10001,10002,10010,10015]
user_group=98
user_name="muahsystems GmbH"
isMentionUser=false
isDynamicsUser=false
isSAPUser=false
isSAPOneUser=false
isSelectLineUser=false
isMicrotechUser=false
isLexwareUser=false
isCOUser=false
isAutotaskUser=false
isWeClappUser=false
isD365User=false
isERPNextUser=false
isBWUser=false
init_error=
Ext.onReady(function() {
var el = Ext.DomQuery.select('#ca-footer');
el[0].innerHTML = user_name;
// debugger;
/* TAB bei Messagebox abfangen */
cop.initKeyMap();
Ext.getBody().on('keyup', function(e, t){
if (e.TAB == e.getKey()) {
var top_win = Ext.WindowMgr.getActive();
if (top_win && top_win.modal) {
if (!top_win.getEl().contains(document.activeElement)) {
var found = false;
var first_focus = top_win.findBy(function(cmp, win){
var ti = cmp.getEl().dom.tabIndex;
if ('hidden' != cmp.getXType() && 'panel' != cmp.getXType() &&
'form' != cmp.getXType() &&
!cmp.hidden &&
ti >= 0 &&
!found) {
found = true;
return true;
}
return false;
});
if (first_focus.length > 0) {
first_focus[0].focus(true);
}
else {
top_win.focus();
}
}
}
}
}, this);
Ext.Ajax.on('requestexception', function(conn,response,options){
if(response.status==403){
window.location.reload();
}
if(options.jsonData.method == "checkArticle"){
return;
}
if(response.statusText == 'communication failure' || response.statusText == 'transaction aborted'){
if(options.jsonData.method == 'getMessages' || options.jsonData.method == 'getStatusLog'){
return;
}
if(options.jsonData.method == 'sendOrders') {
cop.msg.error({
code : response.status,
message : 'Verbindungsabbruch',
description : "Keine Rückmeldung vom IT-System des Lieferanten, bitte erfragen Sie den Bestellstatus direkt beim Lieferanten!",
function_name : 'sendOrders'
});
return;
}
}
cop.msg.error({
code:response.status,
message:response.statusText,
description:response.responseText
});
return;
});
cop.rpcprovider = Ext.Direct.addProvider({
type: 'jsonrpc',
url: rpc_url,
//remote: remote_url,
session:cp,
id: 'PCopRpc',
namespace: 'coprpc',
enableBuffer: false,
listeners: {
'connect': loaded,
'exception': cop.msg.error,
'rpcerror': function(e,args){
if (e.code == 403.003) {
this.session.clear('sid');
cop.msg.login({
success: function(d){
cp.set('sid',d.sid);
copdesk.desktop.taskbar.setStartBtn(true);
(args[3]||function(){}).call(args[4]||this);
},
cancel: function(){
cp.set('sid','nosid');
window.location.reload();
}
});
}
else {
if(!inArray(['db:9'],e.code)){
cop.msg.error(e);
}
}
return false;
}
}
});
function loaded(){
/*
cop.keepAliveTask = {
run: function(){
coprpc.getMessages({},{
success: function(t,e){
},
failure: function(t,e){
}
});
},
interval: 1000*5
};
Ext.TaskMgr.start(cop.keepAliveTask);
*/
cop.Messages = Ext.extend(Ext.util.Observable, {
msgCt : null,
constructor : function () {
this.addEvents(
'newMsg'
);
this.msgs = {};
this.msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div'}, true);
this.msgCt.setStyle('position', 'absolute');
this.msgCt.setStyle('z-index', 9999);
this.msgCt.setWidth(300);
this.ready = true;
},
getNew : function() {
if(cp.get('sid')=='nosid'){
return;
}
coprpc.getMessages({},{
success : function (t,e){
for(var i=0;i'
].join('');
}
});
cop.Messages = new cop.Messages();
cop.Messages.on('newMsg',function (msg) {
if(msg.msg_cat == 1){
cop.msg.alert(msg.msg_subject,msg.msg_text,function(){
cop.Messages.ready = true;
});
}
});
cop.Messages.on('newMsg',function (msg) {
if(msg.msg_cat != 1){
cop.Messages.addMessage(msg.msg_subject,msg.msg_text);
coprpc.setMsgRead({msg:msg});
}
});
cop.MsgTask = {
interval : 15000,
run : function () {
cop.Messages.getNew();
}
};
cop.MsgTask = Ext.TaskMgr.start(cop.MsgTask);
coprpc.getUsersOnline({}, {
success: function(t, e) {
copdesk.desktop.taskbar.setStartBtn(true);
copdesk.autoStartModules();
},
failure: function() {
cp.set('sid', 'nosid');
copdesk.autoStartModules();
}
});
}
});