Revision 65690235
Von Moritz Bunkus vor fast 10 Jahren hinzugefügt
js/kivi.CustomerVendor.js | ||
---|---|---|
41 | 41 |
} |
42 | 42 |
}; |
43 | 43 |
|
44 |
this.setCustomVariablesFromAJAJ = function(cvars) { |
|
45 |
for (var key in cvars) { |
|
46 |
var cvar = cvars[key]; |
|
47 |
var $ctrl = $('#contact_cvars_'+ key); |
|
48 |
|
|
49 |
console.log($ctrl, cvar); |
|
50 |
|
|
51 |
if (cvar.type == 'bool') |
|
52 |
$ctrl.prop('checked', cvar.value == 1 ? 'checked' : ''); |
|
53 |
|
|
54 |
else if ((cvar.type == 'customer') || (cvar.type == 'vendor')) |
|
55 |
kivi.CustomerVendorPicker($ctrl).set_item({ id: cvar.id, name: cvar.value }); |
|
56 |
|
|
57 |
else if (cvar.type == 'part') |
|
58 |
kivi.PartPicker($ctrl).set_item({ id: cvar.id, name: cvar.value }); |
|
59 |
|
|
60 |
else |
|
61 |
$ctrl.val(cvar.value); |
|
62 |
} |
|
63 |
}; |
|
64 |
|
|
44 | 65 |
this.selectContact = function(params) { |
45 | 66 |
var contactId = $('#contact_cp_id').val(); |
46 | 67 |
|
... | ... | |
51 | 72 |
for(var key in contact) |
52 | 73 |
$(document.getElementById('contact_'+ key)).val(contact[key]) |
53 | 74 |
|
54 |
var cvars = data.contact_cvars; |
|
55 |
for(var key in cvars) |
|
56 |
$(document.getElementById('contact_cvars_'+ key)).val(cvars[key]); |
|
75 |
kivi.CustomerVendor.setCustomVariablesFromAJAJ(data.contact_cvars); |
|
57 | 76 |
|
58 | 77 |
if ( contactId ) |
59 | 78 |
$('#action_delete_contact').show(); |
Auch abrufbar als: Unified diff
CustomerVendor: CVars bei Wechsel von Ansprechpersonen richtig befüllen