churn.blade.php
3.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<div class="layout-app"><!-- row-app -->
<div class="row row-app">
<div class="col-md-12">
<div class="col-separator col-separator-first col-unscrollable box">
<div class=innerAll>
<div style='clear:both;margin:2% 0 0 1%;'>
<div class='col-xs-3'>
<select id='usrname' class=select2multi multiple="" style="width: 70%;">
<option value></option>
<?php foreach($rclientlst as $lst){echo "<option value='$lst'>$lst</option>";} ?>
</select>
</div>
<div class='col-xs-7' id="churnTxts">
@for($i=$cntlistVal;$i>0;$i--)
<div class="row">
<div class="col-xs-1">
<p style="float: right;">{{$i}}</p>
<input type="hidden" id="listPrior{{$i}}" value="{{$i}}">
</div>
<select id='listTxt{{$i}}' class="listTxt form_hrm_select select2multi col-xs-4">
<option value></option>
<?php foreach($listVal as $val){echo "<option value='$val->list_value'>$val->list_value</option>";} ?>
</select>
<div id="condDiv{{$i}}" class=" col-xs-4"></div>
</div>
<br>
@endfor
</div>
<div class='container'>
<button type="button" class="btn btn-success" id='assign' style=' margin: 15px 0 5px 770px;'>
<span class="glyphicon glyphicon-plus"></span> Assign CurrentQueue
</button>
</div>
<script type="text/javascript">
var churnArr = [];
for(var i={{$cntlistVal}};i>0;i--)
{
$('#listTxt'+i).click(function()
{
var eleId=$(this).attr('id');
var k = parseInt(eleId.slice(-1));
var currVal = $(this).val();
if(currVal == "")
{
$("#condDiv"+k).html();
}
/* Start - Don not allow to select same value*/
for(var j={{$cntlistVal}};j>0;j--)
{
var othrListTxt=$("#listTxt"+j).select2("val");
if((currVal==othrListTxt)&&k!=j)
{
alert("Already selected,Please select something else!");
$(this).select2("val","");
return;
}
}
/* End - Don not allow to select same value*/
if(currVal == "bucket" || currVal == "emi" || currVal == "pos" || currVal == "overdueAmount")
{
$("#condDiv"+k).html();
$("#condDiv"+k).html("<label><input type='radio' class='condRad' name='condRad' value='ASC'>ASC</label> <label><input type='radio' class='condRad' name='condRad' value='DESC'>DESC</label><input type='hidden' id='condRadVal' value>");
}
if(currVal == "location" || currVal == "state" || currVal == "product")
{
$("#condDiv"+k).html();
$("#condDiv"+k).html("<input type='text' class='form_new' id='subVal"+k+"' name='state_value' value=''>");
}
churnArr[k]={};
churnArr[k]['priority'] = $("#listPrior"+k).val();
churnArr[k]['value'] = $(this).val();
$("#subVal"+k).blur(function(){
churnArr[k]['subValue'] = $(this).val();
});
$("#condDiv"+k).on('click', '.condRad', function(){
churnArr[k]['subValue'] = $(this).val();
});
});
$('.listTxt').on("select2:unselect", function (e) {
alert('cleared');
});
}
//To save all details
$('#assign').click(function()
{
var postdata='agent='+$('#usrname').val();
postdata+='&data='+encodeURIComponent(JSON.stringify(churnArr));
doAjax('churn_save',postdata,'','ajaxMutex_recSaveData','singlethis','POST',function(retstr){
simpleNotification("success","topright","Current queue logic saved successfully!");
$('#usrname').select2("val","");
for(var i={{$cntlistVal}};i>0;i--)
{
$('#listTxt'+i).select2("val","");
$("#condDiv"+i).empty();
}
});
});
</script>
</div>
</div>
</div>
</div>
</div>
</div>