-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathleadtablepage.php
executable file
·224 lines (178 loc) · 11.2 KB
/
leadtablepage.php
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
</head>
<!-- <body style="background: url(img/3.jpg) no-repeat bottom right ;
background-size: cover;"> -->
<body>
<form action="" method="post">
<div style="width: 80%">
<div >
<div style="width:80%" align='right'>
<input type="button" class='btn btn-info' value="New" onclick="window.location='enq_form.php'" />
<a href="csv.html" class="btn btn-success">Import</a>
</div>
<div id="tog" class="alert alert-success alert-dismissible">
<input type="submit" name="sendmail" value="Send Mail" onclick="javascript: form.action='a1.php'" class="btn btn-info"/>
<input type="submit" value="Create task" name="addtask" onclick="javascript: form.action='mul_new_task.php'" class="btn btn-success" />
</div>
<div style="background-color:#fff;opacity:.9">
<table class="table table-striped" >
<tr style='font-family:Britannic Bold;font-size:16;background-color: #ff6f61;'>
<th></th>
<th>Code</th><th>Clients</th><th>Task</th><th>Priority</th><th>Due Date</th><th>Action Description</th><th>Status</th><th>Assign to</th><th>Remarks</th></tr>
<?php
$con=mysqli_connect("localhost","root","","mytravaly") or die( mysqli_connect_error());
$task_list=mysqli_query($con,"select ClientId,FirstName from client_details") or die(mysqli_error($con));
$data_per_page = 4;
$records = mysqli_num_rows($task_list);
$no_of_page = ceil($records / $data_per_page);
if(!isset($_GET['page']) || $_GET['page']<=0){
$page = 1;
}else{
$page = $_GET['page'];
}
$page_limit_data = ($page - 1) * $data_per_page;
$task_list1=mysqli_query($con,"select ClientId,FirstName from client_details LIMIT " . $page_limit_data . "," . $data_per_page) ;
while($row = mysqli_fetch_assoc($task_list1))
{
echo "<tr>
<td>
<input type='checkbox' class='form-checkbox' name='client_check_list[]' value='".$row['ClientId']."' id='".$row['ClientId']."'></td>
<td>".$row['ClientId']."</td>
<td>".$row['FirstName']."</td>";
$query=mysqli_query($con,"select Status from task_details where ClientId=".$row['ClientId']." and Status!='COMPLETED'");
if($hastask=mysqli_num_rows($query)>0)
{
$task_type_list=mysqli_query($con,"select * from task_details where ClientId=".$row['ClientId']." and Status!='COMPLETED' order by DueDate LIMIT 1;");
while($t=mysqli_fetch_assoc($task_type_list))
$task=$t;
//task column
if($task['Task']=='Call'){
echo " <td><a href='task.php?cid=".$row['ClientId']."&tid=".$task['TaskId']."&task=".$task['Task']."'><img src='img/phone.png' height='35px' width='35px'></a></td>";
}
else if($task['Task']=='Email'){
echo " <td><a href='task.php?cid=".$row['ClientId']."&tid=".$task['TaskId']."&task=".$task['Task']."'><img src='img/email.png' height='35px' width='35px'></a></td>";
}
else if($task['Task']=='Message'){
echo " <td><a href='task.php?cid=".$row['ClientId']."&tid=".$task['TaskId']."&task=".$task['Task']."'><img src='img/msg.png' height='35px' width='35px'></a></td>";
}
else if($task['Task']=="Product Demo")
{
echo " <td><a href='task.php?cid=".$row['ClientId']."'><img src='img/gallery.png' height='35px' width='35px'></a></td>";
}
//priority column
if($task['Priority']!='')
echo "<td>".$task['Priority']."</td>";
else
echo "<td><a href='edit_task.php?cid=".$row['ClientId']."&tid=".$task['TaskId']."'>set priority</a></td>";
//Due Date column
if($task['DueDate']!='')
echo "<td>".$task['DueDate']."</td>";
else
echo "<td><a href='edit_task.php?cid=".$row['ClientId']."&tid=".$task['TaskId']."'>Due Date</a></td>";
//action description column
if($task['Description']!='')
echo "<td>".$task['Description']."</td>";
else
echo "<td><a href='edit_task.php?cid=".$row['ClientId']."&tid=".$task['TaskId']."'>Action Description</a></td>";
//status column
if($task['Status']!='')
echo "<td><a href='edit_task.php?cid=".$row['ClientId']."&tid=".$task['TaskId']."'>".$task['Status']."</a></td>";
else
echo "<td><a href='edit_task.php?cid=".$row['ClientId']."&tid=".$task['TaskId']."'>Status</a></td>";
//assign To
echo "<td>";
echo "<select name='assign_to' style='width:100px' class='myDropDown'>";
echo "<option value='' disabled selected>---select---</option>";
$emp_list=mysqli_query($con,"select name,email from employee") or die(mysqli_error($con));
while ($row3=mysqli_fetch_assoc($emp_list)) {
$v=$task['TaskId']."/".$row3['email'].'/'.$row3['name'];
if($task['AssignTo']==$row3['name'])
echo "<option value='$v' selected='selected'>".$row3['name']."</option>";
else
echo "<option value='$v'>".$row3['name']."</option>";
}
echo "</td>";
//remarks column
if($task['Remarks']!='')
echo "<td>".$task['Remarks']."</td>";
else
echo "<td><a href='edit_task.php?cid=".$row['ClientId']."&tid=".$task['TaskId']."'>Remarks</a></td>";
echo "</tr></tr>";
}
else
{
echo " <td><a href='new_task.php?cid=".$row['ClientId']."'><img src='img/add.png' height='35px' width='35px'></a></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td></tr>
";
}
}
?>
</table>
</div>
<div align="right">
<label class="btn btn-danger">Number of Clients : <?php echo $records; ?> / Total Pages : <?php echo $no_of_page; ?></label>
<input type="number" id='pageno' style="width:60px" placeholder="Pg no">
<input type="button" id="search" style="width:70px" class="btn btn-info" value="Search"/>
<?php if($page==1)
{
$nextpage=$page+1;
echo "<button class='btn btn-warning' style='width:70px'>$page</button><a href='leadtablepage.php?page=$nextpage'><input type='button' style='width:70px' value='Next' class='btn btn-success'/></a> " ;
}
else {
$nextpage=$page+1;
$prevpage=$page-1;
echo "<a href='leadtablepage.php?page=$prevpage'><input type='button' style='width:70px' value='Prev' class='btn btn-success'/></a><button class='btn btn-warning' style='width:70px'>$page</button></b><a href='leadtablepage.php?page=$nextpage'><input type='button'style='width:70px' value='Next' class='btn btn-success'/></a> " ;
}
?>
</div>
</div>
</form>
</body>
</html>
<!-- script for showing pop-up menu for send mail and add task -->
<script>
var tog = $("#tog").hide();
$('.form-checkbox').change(function () {
$(tog).toggle($('.form-checkbox:checked').length > 0);
}).change();
</script>
<!-- script for assign to new with sending notification mail -->
<script>
$(document).ready(function(){
$('.myDropDown').change(function(){
//Selected value
var inputValue = $(this).val();
var string1=inputValue.split("/");
var tid=string1[0];
var eid=string1[1];
var ename=string1[2];
alert("Sending a Mail To "+ename+" : "+eid);
//Ajax for calling php function
$.post('demo.php', {taskid:tid,email:eid,name:ename}, function(data){
alert('Mail Sent Successfully...');
location.reload();
//do after submission operation in DOM
});
});
});
</script>
<script >
$(document).ready(function(){
$('#search').click(function()
{
var id=$('#pageno').val();
window.location='leadtablepage.php?page='+id;
});
});
</script>