forked from goautodial/v4.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloadleads.php
269 lines (246 loc) · 10.4 KB
/
loadleads.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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<?php
require_once('./php/UIHandler.php');
require_once('./php/CRMDefaults.php');
require_once('./php/LanguageHandler.php');
include('./php/Session.php');
$ui = \creamy\UIHandler::getInstance();
$lh = \creamy\LanguageHandler::getInstance();
$user = \creamy\CreamyUser::currentUser();
?>
<html>
<head>
<meta charset="UTF-8">
<title>Goautodial</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<!-- Ionicons -->
<link href="css/ionicons.min.css" rel="stylesheet" type="text/css" />
<!-- bootstrap wysihtml5 - text editor -->
<link href="css/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css" rel="stylesheet" type="text/css" />
<!-- Creamy style -->
<link href="css/creamycrm.css" rel="stylesheet" type="text/css" />
<?php print $ui->creamyThemeCSS(); ?>
<!-- Circle Buttons style -->
<link href="css/circle-buttons.css" rel="stylesheet" type="text/css" />
<!-- DATA TABLES -->
<link href="css/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<!-- Wizard Form style -->
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css/easyWizard.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/jquery-ui.min.js" type="text/javascript"></script>
<!-- Bootstrap WYSIHTML5 -->
<script src="js/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js" type="text/javascript"></script>
<!-- Creamy App -->
<script src="js/app.min.js" type="text/javascript"></script>
<!-- Data Tables -->
<script src="js/plugins/datatables/jquery.dataTables.js" type="text/javascript"></script>
<script src="js/plugins/datatables/dataTables.bootstrap.js" type="text/javascript"></script>
<!-- preloader -->
<link rel="stylesheet" href="css/customizedLoader.css">
<script type="text/javascript">
$(window).ready(function() {
$(".preloader").fadeOut("slow");
})
</script>
</head>
<?php print $ui->creamyBody(); ?>
<div class="wrapper">
<!-- header logo: style can be found in header.less -->
<?php print $ui->creamyHeader($user); ?>
<!-- Left side column. contains the logo and sidebar -->
<?php print $ui->getSidebar($user->getUserId(), $user->getUserName(), $user->getUserRole(), $user->getUserAvatar()); ?>
<!-- Right side column. Contains the navbar and content of the page -->
<aside class="right-side">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?php $lh->translateText("load_leads"); ?>
<small>(Upload/Import Leads)</small>
</h1>
<ol class="breadcrumb">
<li><a href="./index.php"><i class="fa fa-phone"></i> <?php $lh->translateText("home"); ?></a></li>
<li><?php $lh->translateText("load_leads"); ?></li>
<li class="active">Upload/Import Leads</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<?php if ($user->userHasAdminPermission()) { ?>
<div class="clearfix">
<div class="col-xs 12">
<div class="box box-default">
<?php
if(isset($_GET['message'])){
echo '<div class="col-lg-12" style="margin-top: 10px;">';
if($_GET['message'] == "Success"){
echo '<div class="alert alert-success">
<strong>Success!</strong> Upload of leads was successful.
</div>';
}else{
echo '<div class="alert alert-danger">
<strong>Error!</strong> Something went wrong please contact administrator.
</div>';
}
echo '</div>';
}
?>
<div class="box-header">
<h3 class="box-title"><?php $lh->translateText("load_leads"); ?></h3>
</div><!-- /.box-header -->
<div class="box-body clearfix" id="load_leads">
<div class="col-lg-12">
<?php
$lists = $ui->API_goGetAllLists();
// print_r($lists);
?>
<form class="form-horizontal" action="./php/AddLoadLeads.php" method="POST" enctype="multipart/form-data">
<div class="form-group">
<label class="">List ID:</label>
<div>
<select class="form-control" name="list_id">
<option value="">-- Select List ID --</option>
<?php
for($i=0;$i<count($lists->list_id);$i++){
echo '<option value="'.$lists->list_id[$i].'">'.$lists->list_id[$i].'</option>';
}
?>
</select>
</div>
</div>
<div class="form-group">
<label class="">CSV File:</label>
<div>
<div class="input-group">
<input type="text" class="form-control file-name" name="file_name" placeholder="CSV File">
<span class="input-group-btn">
<button type="button" class="btn btn-default browse-btn" type="button">Browse</button>
</span>
</div><!-- /input-group -->
<input type="file" class="file-box hide" name="file_upload">
</div>
</div>
<div class="form-group">
<div class="pull-right">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</div>
</form>
</div>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div>
</div>
<!-- /fila con acciones, formularios y demás -->
<?php
} else {
print $ui->calloutErrorMessage($lh->translationFor("you_dont_have_permission"));
}
?>
</script>
</section><!-- /.content -->
</aside><!-- /.right-side -->
<?php print $ui->getRightSidebar($user->getUserId(), $user->getUserName(), $user->getUserAvatar()); ?>
</div><!-- ./wrapper -->
<!-- Forms and actions -->
<script src="js/jquery.validate.min.js" type="text/javascript"></script>
<script src="js/easyWizard.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#T_users').dataTable();
$('.browse-btn').click(function(){
$('.file-box').click();
});
$('.file-box').change(function(){
var myFile = $(this).prop('files');
var Filename = myFile[0].name;
$('.file-name').val(Filename);
console.log($(this).val());
});
// for easy wizard -
$("#wizard-modal").wizard({
onnext:function(){
//alert("Nexted!");
var phone_logins = document.getElementById('phone_logins').value;
document.getElementById("phone_login1").value = phone_logins;
if(phone_logins == null || phone_logins == ""){
alert("Please Fill All Required Field");
return false;
}
},
onfinish:function(){
$.ajax({
/*url: ".\php\AddCampaign.php",*/
url: "./php/CreateTelephonyUser.php",
type: 'POST',
data: $("#create_form").serialize(),
success: function(data) {
// console.log(data);
if(data == 1){
$('.output-message-success').removeClass('hide');
$('.output-message-error').addClass('hide');
window.location = window.location.href;
}else{
$('.output-message-error').removeClass('hide');
$('.output-message-success').addClass('hide');
}
}
});
}
});
/* additional number custom*/
$('#seats').on('change', function() {
// alert( this.value ); // or $(this).val()
if(this.value == "custom_seats") {
$('#custom_seats').show();
}
if(this.value != "custom_seats") {
$('#custom_seats').hide();
}
});
/* generate phone logins*/
$('#generate_phone_logins').on('change', function() {
// alert( this.value ); // or $(this).val()
if(this.value == "Y") {
$('#phone_logins_form').show();
}
if(this.value == "N") {
$('#phone_logins_form').hide();
}
});
/**
* Edit user details
*/
$(".edit-T_user").click(function(e) {
e.preventDefault();
var url = 'edittelephonyuser.php';
var form = $('<form action="' + url + '" method="post"><input type="hidden" name="userid" value="' + $(this).attr('href') + '" /></form>');
$('body').append(form); // This line is not necessary
$(form).submit();
});
/**
* Delete user.
*/
$(".delete-T_user").click(function(e) {
var r = confirm("<?php $lh->translateText("are_you_sure"); ?>");
e.preventDefault();
if (r == true) {
var user_id = $(this).attr('href');
$.post("./php/DeleteTelephonyUser.php", { userid: user_id } ,function(data){
if (data == "<?php print CRM_DEFAULT_SUCCESS_RESPONSE; ?>") { location.reload(); }
else { alert ("<?php $lh->translateText("unable_delete_user"); ?>"); }
});
}
});
});
</script>
</body>
</html>