| 13758 |
anikendra |
1 |
$(function(){
|
| 14098 |
anikendra |
2 |
if($('.brandedit').length){
|
|
|
3 |
$('.brandedit').on('click',function(){
|
|
|
4 |
var that = $(this);
|
|
|
5 |
var value = 0;
|
|
|
6 |
if($(this).prop('checked')){
|
|
|
7 |
value = 1;
|
|
|
8 |
}
|
|
|
9 |
$.post($(this).data('url'),{'id':$(this).data('id'),'displayed_in_preference_page':value},function(data){
|
|
|
10 |
if(data.success){$(that).parent().append('Done');};
|
|
|
11 |
})
|
|
|
12 |
});
|
|
|
13 |
}
|
|
|
14 |
$('.edit').editable(base_url+'admin/'+controller+'/update/',{
|
| 14584 |
anikendra |
15 |
onsubmit: function(settings, td) {
|
|
|
16 |
var r = confirm('Copy to catalog?');
|
|
|
17 |
if (r == true) {
|
|
|
18 |
$(td).data('multi',1);
|
|
|
19 |
} else {
|
|
|
20 |
$(td).data('multi',0);
|
|
|
21 |
}
|
| 14098 |
anikendra |
22 |
var input = $(td).find('input');
|
|
|
23 |
var original = input.val();
|
|
|
24 |
if (isNumeric(original)) {
|
|
|
25 |
console.log("Validation correct");
|
|
|
26 |
return true;
|
|
|
27 |
} else {
|
|
|
28 |
console.log("Validation failed. Ignoring");
|
|
|
29 |
input.css('background-color','#c00').css('color','#fff');
|
|
|
30 |
return false;
|
|
|
31 |
}
|
|
|
32 |
},
|
|
|
33 |
indicator : 'Saving...',
|
|
|
34 |
tooltip : 'Click to edit...',
|
|
|
35 |
submit : 'OK',
|
|
|
36 |
submitdata : function(value, settings) {
|
| 14584 |
anikendra |
37 |
return {oid: $(this).data('oid'),multi: $(this).data('multi')};
|
| 14098 |
anikendra |
38 |
}
|
|
|
39 |
});
|
| 14408 |
anikendra |
40 |
$('.sqlslecter').on('click',function(){
|
|
|
41 |
$('#UserSql').html($(this).parent().siblings('.updatesql').html());
|
|
|
42 |
})
|
|
|
43 |
$('.pushtoalll').on('click',function(){
|
|
|
44 |
var that = $(this);
|
|
|
45 |
$('.userIds').each(function(){
|
|
|
46 |
$(this).prop('checked',$(that).prop('checked'));
|
|
|
47 |
})
|
|
|
48 |
});
|
|
|
49 |
$('.notifyusers').on('click',function(){
|
|
|
50 |
if($('#UserMessage').val().length == 0 || $('#UserMessage').val()==''){
|
|
|
51 |
alert('Enter a message first');
|
|
|
52 |
return false;
|
|
|
53 |
}else{
|
|
|
54 |
$('#UserPushForm').submit();
|
|
|
55 |
}
|
|
|
56 |
})
|
| 14600 |
anikendra |
57 |
$('#MasterDataCategoryId').on('change',function(){
|
|
|
58 |
console.log($('#MasterDataCategoryId option:selected').text());
|
|
|
59 |
$('#MasterDataCategory').val($('#MasterDataCategoryId option:selected').text());
|
|
|
60 |
});
|
|
|
61 |
$('#MasterDataSourceId').on('change',function(){
|
|
|
62 |
console.log($("#MasterDataSourceId option:selected").text());
|
|
|
63 |
$('#MasterDataSource').val($("#MasterDataSourceId option:selected").text());
|
|
|
64 |
$('#MasterDataSecondaryIdentifier').prop('required',false);
|
|
|
65 |
if($(this).val()==3){
|
|
|
66 |
$('#MasterDataSecondaryIdentifier').prop('required','required');
|
|
|
67 |
}
|
|
|
68 |
});
|
|
|
69 |
$('#MasterDataInStock').on('change',function(){
|
|
|
70 |
console.log($('#MasterDataInStock option:selected').text());
|
|
|
71 |
$('#MasterDataStockStatus').val($('#MasterDataInStock option:selected').text());
|
| 14849 |
anikendra |
72 |
});
|
|
|
73 |
$('#NotificationRuleType').on('change',function(){
|
|
|
74 |
if($('#NotificationRuleType option:selected').text() =='Popup'){
|
|
|
75 |
$('#NotificationRulePopupDisplayCount').prop('disabled',false);
|
|
|
76 |
$('#NotificationRulePopupDisplayInterval').prop('disabled',false);
|
| 14928 |
anikendra |
77 |
$('#NotificationRulePopupType').prop('disabled',false);
|
| 14849 |
anikendra |
78 |
}else{
|
|
|
79 |
$('#NotificationRulePopupDisplayCount').prop('disabled',true);
|
|
|
80 |
$('#NotificationRulePopupDisplayInterval').prop('disabled',true);
|
| 14928 |
anikendra |
81 |
$('#NotificationRulePopupType').prop('disabled',true);
|
| 14849 |
anikendra |
82 |
}
|
|
|
83 |
})
|
| 14098 |
anikendra |
84 |
});
|
|
|
85 |
function isNumeric(value) {
|
|
|
86 |
if (value == null || !value.toString().match(/^[-]?\d*\.?\d*$/)) return false;
|
|
|
87 |
return true;
|
| 19142 |
naman |
88 |
}
|
|
|
89 |
|
|
|
90 |
$(document).on('change', '#MasterDataSourceId', function(e) {
|
|
|
91 |
var text = this.options[e.target.selectedIndex].text;
|
|
|
92 |
if(text == 'saholic')
|
|
|
93 |
{
|
|
|
94 |
$("#MasterDataShowNetPrice").prop('checked', true);
|
|
|
95 |
}
|
|
|
96 |
else
|
|
|
97 |
{
|
|
|
98 |
$("#MasterDataShowNetPrice").prop('checked', false);
|
|
|
99 |
}
|
|
|
100 |
});
|