Skip to content

Commit dbab6c5

Browse files
committed
2 parents 35522b6 + 1d68b50 commit dbab6c5

22 files changed

+168
-44
lines changed

.htaccess

-2
This file was deleted.

admin/Asset/js/myScript.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ $(document).on('click', '.add_customer', function(){
2121
var name = $('#name').val();
2222
var phone = $('#phone').val();
2323
var email = $('#email').val();
24+
var birth = $('#birth').val();
2425

25-
$.post('Server/Customer/add_customer.php', { name: name, phone: phone, email: email }, function(data){
26+
$.post('Server/Customer/add_customer.php', { name: name, phone: phone, email: email, birth: birth }, function(data){
2627

2728
$(".modal:visible").modal('toggle');
2829
$('body').removeClass('modal-open');

admin/Asset/js/pages/dashboard.init.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,12 @@
118118
xAxes: [{ gridLines: { color: "rgba(0,0,0,0.1)" } }],
119119
},
120120
}
121-
);
122-
121+
);
123122
}),
124-
125123
(i.ChartJs = new e()),
126124
(i.ChartJs.Constructor = e);
127125
})(window.jQuery),
126+
(function (e) {
127+
"use strict";
128+
window.jQuery.ChartJs.init();
129+
})();

admin/Controller/Customer/Customer_c_ajax.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ public function removeCustomer($id) {
1515
return $this->customer->removeCustomer($id);
1616
}
1717

18-
public function addCustomer($name,$showroom_id, $phone, $email){
18+
public function addCustomer($name,$showroom_id, $phone, $email, $birth){
1919

20-
return $this->customer->addCustomer($name, $showroom_id, $phone, $email);
20+
return $this->customer->addCustomer($name, $showroom_id, $phone, $email, $birth);
2121

2222
}
2323

admin/Controller/CustomerCare/CustomerCare_c_ajax.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public function removeCustomerCare($customer_id){
2323

2424
}
2525

26-
public function addUserGet($user_id_get, $customer_id){
26+
public function addUserGet($user_id_get, $customer_id, $status){
2727

28-
return $this->customer_care->addUserGet($user_id_get, $customer_id);
28+
return $this->customer_care->addUserGet($user_id_get, $customer_id, $status);
2929

3030
}
3131

@@ -35,9 +35,9 @@ public function addHistory($user_id_move, $customer_id, $user_id_get){
3535

3636
}
3737

38-
public function addNoti($user_id_move, $customer_id, $user_id_get){
38+
public function addNoti($user_id_move, $customer_id, $status, $user_id_get){
3939

40-
return $this->customer_care->addNoti($user_id_move, $customer_id, $user_id_get);
40+
return $this->customer_care->addNoti($user_id_move, $customer_id, $status, $user_id_get);
4141

4242
}
4343

admin/Controller/Order/order_c.php

+8
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ public function Order() {
5050
$personalTransference = $this->order->personalTransference($_SESSION['id']);
5151

5252
$getShowroomId = $this->order->getShowroomId($_SESSION['id']);
53+
54+
$ratingCount = $this->order->ratingCount($_SESSION['id']);
55+
56+
$ratingFiveCount = $this->order->ratingFiveCount($_SESSION['id']);
57+
58+
$personalCusTransference = $this->order->personalCusTransference($_SESSION['id']);
59+
60+
$personalRecareCustomer = $this->order->personalRecareCustomer($_SESSION['id']);
5361
include_once("View/Dashboard/dashboard.php");
5462

5563
}

admin/Controller/Product/Product_c.php

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function createOrder () {
4444
}
4545
$rows = join($table);
4646
$this->product->sendMail($customer['email'], $customer['Tên khách hàng'], $rows, $total);
47+
$this->product->sendSMS($customer['phone'], $customer['Tên khách hàng']);
4748
}
4849
if ($user_id_care == $user_id_buy) {
4950
$add6 = $this->product->addBonus6($user_id_care);

admin/Model/Customer/Customer_m_ajax.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ function __construct()
1010
}
1111

1212
//Thêm khách hàng vào bảng tbl_customer
13-
protected function addCustomer($name,$showroom_id, $phone, $email){
14-
$sql = "INSERT INTO tbl_customer (name,showroom_id, phone, email) VALUES (:name, :showroom_id, :phone, :email)";
13+
protected function addCustomer($name,$showroom_id, $phone, $email, $birth){
14+
$sql = "INSERT INTO tbl_customer (name,showroom_id, phone, email, birth) VALUES (:name, :showroom_id, :phone, :email, :birth)";
1515
$pre = $this->pdo->prepare($sql);
1616

1717
$pre->bindParam(':name', $name);
1818
$pre->bindParam(':showroom_id', $showroom_id);
1919
$pre->bindParam(':phone', $phone);
2020
$pre->bindParam(':email', $email);
21+
$pre->bindParam(':birth', $birth);
2122

2223
return $pre->execute();
2324

admin/Model/CustomerCare/CustomerCare_m_ajax.php

+9-4
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,16 @@ protected function removeCustomerCare($customer_id){
3333
}
3434

3535
//Thêm khách hàng vào bảng tbl_care
36-
protected function addUserGet($user_id_get, $customer_id){
37-
$sql = "INSERT INTO tbl_care(user_id, customer_id) VALUES (:user_id_get, :customer_id)";
36+
protected function addUserGet($user_id_get, $customer_id, $status){
37+
$sql = "INSERT INTO tbl_care(user_id, customer_id, status) VALUES (:user_id_get, :customer_id, :status)";
3838

3939
$pre = $this->pdo->prepare($sql);
4040

4141
$pre->bindParam(':user_id_get', $user_id_get);
4242

4343
$pre->bindParam(':customer_id', $customer_id);
44+
45+
$pre->bindParam(':status', $status);
4446

4547
return $pre->execute();
4648
}
@@ -55,6 +57,7 @@ protected function getNoti () {
5557
usermove.name AS 'Nhân viên chuyển',
5658
userget.name AS 'Nhân viên nhận',
5759
tnt.user_id_get,
60+
tnt.status,
5861
tnt.create_at
5962
FROM
6063
tbl_user AS usermove
@@ -100,15 +103,17 @@ protected function addHistory($user_id_move, $customer_id, $user_id_get){
100103
}
101104

102105
//Thêm vào bảng tbl_transfer_noti
103-
protected function addNoti($user_id_move, $customer_id, $user_id_get){
104-
$sql = "INSERT INTO tbl_transfer_noti(user_id_move, customer_id, user_id_get) VALUES (:user_id_move, :customer_id, :user_id_get)";
106+
protected function addNoti($user_id_move, $customer_id, $status, $user_id_get){
107+
$sql = "INSERT INTO tbl_transfer_noti(user_id_move, customer_id, status, user_id_get) VALUES (:user_id_move, :customer_id, :status, :user_id_get)";
105108

106109
$pre = $this->pdo->prepare($sql);
107110

108111
$pre->bindParam(':user_id_get', $user_id_get);
109112

110113
$pre->bindParam(':customer_id', $customer_id);
111114

115+
$pre->bindParam(':status', $status);
116+
112117
$pre->bindParam(':user_id_move', $user_id_move);
113118

114119
return $pre->execute();

admin/Model/Order/order_m.php

+56
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,20 @@ protected function personalCustomerBeingCare($id) {
339339

340340
}
341341

342+
protected function personalRecareCustomer($id) {
343+
344+
$sql = "SELECT user_id FROM tbl_care WHERE user_id = $id AND status = 3";
345+
346+
$pre = $this->pdo->prepare($sql);
347+
348+
$pre->bindParam(":id", $id);
349+
350+
$pre->execute();
351+
352+
return $pre->rowCount();
353+
354+
}
355+
342356
protected function personalTotalCustomer($id) {
343357

344358
$sql = "SELECT user_id FROM tbl_care WHERE user_id = $id";
@@ -367,6 +381,20 @@ protected function personalTransference($id) {
367381

368382
}
369383

384+
protected function personalCusTransference($id) {
385+
386+
$sql = "SELECT customer_id FROM tbl_history WHERE user_id_move = $id";
387+
388+
$pre = $this->pdo->prepare($sql);
389+
390+
$pre->bindParam(":id", $id);
391+
392+
$pre->execute();
393+
394+
return $pre->rowCount();
395+
396+
}
397+
370398
protected function getShowroomId($id) {
371399

372400
$sql = "SELECT * FROM tbl_user, tbl_showroom
@@ -390,4 +418,32 @@ protected function getShowroomId($id) {
390418

391419
}
392420

421+
protected function ratingCount($id) {
422+
423+
$sql = "SELECT user_id FROM tbl_feedback WHERE user_id = $id";
424+
425+
$pre = $this->pdo->prepare($sql);
426+
427+
$pre->bindParam(":id", $id);
428+
429+
$pre->execute();
430+
431+
return $pre->rowCount();
432+
433+
}
434+
435+
protected function ratingFiveCount($id) {
436+
437+
$sql = "SELECT user_id FROM tbl_feedback WHERE user_id = $id AND rate = 5";
438+
439+
$pre = $this->pdo->prepare($sql);
440+
441+
$pre->bindParam(":id", $id);
442+
443+
$pre->execute();
444+
445+
return $pre->rowCount();
446+
447+
}
448+
393449
}

admin/Model/Product/Product_m.php

+26-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ protected function getId ($id) {
4141
tbl_customer.name AS 'Tên khách hàng',
4242
tbl_user.name AS 'NV chăm sóc',
4343
title,
44-
tbl_customer.email
44+
tbl_customer.email,
45+
tbl_customer.phone
4546
FROM
4647
tbl_customer,
4748
tbl_care,
@@ -252,6 +253,30 @@ protected function sendMail($email, $name, $rows, $total){
252253
}
253254
}
254255

256+
// START xử lý gửi tin nhắn cho khách
257+
protected function sendSMS($phone, $customer_name){
258+
$url = 'http://183.91.2.4:6543/mp/brandname?wsdl'; // Link API
259+
260+
$client = new SoapClient($url); // Khởi tạo đối tưởng SoapClient
261+
262+
$brandname = 'DHCH STORE'; // không thay đổi để nguyên
263+
//$phone = '0373263978'; // Đưa số điện thoại của khách cần gửi vào đây
264+
$content = '[TEST]'. ' Chao '.$customer_name.' Don hang cua ban da duoc xac nhan. Tai khoan cua ban: '.$phone.', Mat khau: 123456. Vui long dang nhap trang chu Millennium Watch de doi mat khau va tra cuu lich su mua hang: https://datgautedy.xyz/'; // Nội dung gửi tin nhắn cho khách
265+
266+
$params = array(
267+
'username' => 'dhchapi',
268+
'password' => 'dhchapi@123',
269+
'msgcontent' => $content,
270+
'brandname' => $brandname,
271+
'listuser' => $phone,
272+
'type' => '2',
273+
'templateid' => 'MP001'
274+
);
275+
276+
var_dump($client->SendSMS($params));
277+
}
278+
//END xử lý gửi tin nhắn cho khách
279+
255280
//Hiện danh sách hóa đơn theo customer_id
256281
protected function getOrderHistory ($customer_id) {
257282

admin/Server/Customer/add_customer.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
$user_id = $_SESSION['id'];
1212
$phone = $_POST['phone'];
1313
$email = $_POST['email'];
14+
$birth = $_POST['birth'];
1415

1516
$num = count($customer->checkEmailPhone($phone, $email));
1617
if ($num == 0 && $name != '' && $phone != '' && $email !=''){
17-
$add1 = $customer->addCustomer($name, $showroom_id, $phone, $email);
18+
$add1 = $customer->addCustomer($name, $showroom_id, $phone, $email, $birth);
1819
$add2 = $customer_care->addCustomerCare($user_id);
1920
if ($add1 == true && $add2 == true) {
2021
?>

admin/Server/CustomerCare/accept_transfer.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66

77
$customer_id = $_POST['customer_id'];
88
$rowNoti = $customer_care->getInfoNoti($customer_id);
9+
$status = $rowNoti['status'];
910
$user_id_get = $rowNoti['user_id_get'];
1011
$user_id_move = $rowNoti['user_id_move'];
1112

1213
$delete = $customer_care->removeCustomerCare($customer_id);
13-
$addTblCare = $customer_care->addUserGet($user_id_get, $customer_id);
14+
$addTblCare = $customer_care->addUserGet($user_id_get, $customer_id, $status);
1415
$addTblHistory = $customer_care->addHistory($user_id_move, $customer_id, $user_id_get);
1516
$removeNoti = $customer_care->removeNoti($customer_id);
1617

admin/Server/CustomerCare/transfer_customer.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
$customer_id = $_POST['customer_id'];
1313
$userMove = $customer_care->getUserMove($customer_id);
1414
$user_id_move = $userMove['user_id'];
15+
$status = $userMove['status'];
1516
$nameMove = $customer_care->getUserId($user_id_move);
1617
// $rowUserGet = $customer_care->getUserId($user_id_get);
1718
// $rowUserMove = $customer_care->getUserId($user_id_move);
1819
// $customer_care->sendMail($rowUserGet['email'], $rowUserMove['name']);
1920
// $user_move = $_SESSION['id'];
20-
$addNoti = $customer_care->addNoti($user_id_move, $customer_id, $user_id_get);
21+
$addNoti = $customer_care->addNoti($user_id_move, $customer_id, $status, $user_id_get);
2122

2223
if ($addNoti){
2324
$customer_care->sendMail($mailGet['email'], $mailGet['name'], $nameMove['name'], $user_id_get);

admin/View/Customer/list_customer.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<th>Showroom</th>
1616
<th>Phone</th>
1717
<th>Email</th>
18+
<th>Birthday</th>
1819
<th>Status</th>
1920
<th>Action</th>
2021
</tr>
@@ -28,10 +29,11 @@
2829
<tr>
2930
<td class="text-center"><?php echo $dem+=1; ?></td>
3031
<td><?php echo $value['name']; ?></td>
31-
<td><?php echo $value['title']; ?></td>
32-
<td><?php echo $value['phone']; ?></td>
32+
<td class="text-center"><?php echo $value['title']; ?></td>
33+
<td class="text-center"><?php echo $value['phone']; ?></td>
3334
<td><?php echo $value['email']; ?></td>
34-
<td><?php
35+
<td class="text-center"><?php echo $value['birth']; ?></td>
36+
<td class="text-center"><?php
3537
if ($value['status'] == 1) {
3638
echo "<p style='color: red;'>Busy</p>";
3739
}else if ($value['status'] == 2){

admin/View/CustomerCare/list_customer_care.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
if ($_SESSION['role'] != 1) {
33
?>
44
<a href="dashboard.php?page=add_customer_care">
5-
<button type="button" class="btn btn-primary btn-icon waves-light waves-effect">+ Recare Customer</button>
5+
<button type="button" class="btn btn-primary btn-icon waves-light waves-effect">+ New Care</button>
66
</a>
77
<?php
88
}
@@ -35,8 +35,8 @@
3535
<tr>
3636
<td class="text-center"><?= $count; ?></td>
3737
<td><?= $valueCustomerCare['name'] ?></td>
38-
<td><?= $valueCustomerCare['title'] ?></td>
39-
<td><?= $valueCustomerCare['phone'] ?></td>
38+
<td class="text-center"><?= $valueCustomerCare['title'] ?></td>
39+
<td class="text-center"><?= $valueCustomerCare['phone'] ?></td>
4040
<td><?= $valueCustomerCare['email'] ?></td>
4141
<td class="text-center">
4242
<?php
@@ -49,7 +49,7 @@
4949
}
5050
?>
5151
</td>
52-
<td><?= $valueCustomerCare['create_at'] ?></td>
52+
<td class="text-center"><?= $valueCustomerCare['create_at'] ?></td>
5353

5454
<td class="text-center">
5555
<a href="dashboard.php?page=detail_customer_care&id=<?= $valueCustomerCare['id']; ?>">

0 commit comments

Comments
 (0)