Các nguyên nhân máy in không in được

Nếu bạn đang sử dụng máy in mà bỗng một ngày máy in của bạn không hoạt động hay gặp sự cố không in được thì bạn đừng quá lo lắng nhé! Trong bài viết dưới đây, Musk.vn sẽ chia sẻ tới bạn những lỗi máy in không in được thường gặp phải và cách khắc phục tình huống này.

Các nguyên nhân máy in không in được
Lỗi máy in không in được

Tổng hợp lỗi máy in không in được thường hay gặp 

Có rất nhiều lỗi máy in không in được được tìm thấy và sau đây là các lỗi máy in chính bạn có thể gặp phải, hãy tìm hiểu nguyên nhân để có thể đưa ra cách sửa máy in không in được:

Lỗi máy in Khắc phục sự cố không in được

Lỗi máy in không in được liên quan đến người sử dụng 

Trong quá trình sử dụng máy in, có thể người dùng chưa kết nối máy in với nguồn điện, chưa bật nguồn máy in hoặc chưa kết nối máy in với máy tính. Cũng có nhiều khả năng dây kết nối bị hỏng.

Bên cạnh đó còn có khả năng người dùng chưa chọn máy in mặc định nên khi in sẽ cho kết quả ở một máy in khác mà không phải máy in bạn cần.

>>> Xem thêm:

  • Cách khắc phục máy in báo lỗi kẹt giấy nhưng không có giấy bên trong
  • Cách sửa máy in khi bị kẹt giấy đơn giản, thành công 100%

Lỗi máy in không in được liên quan đến phần mềm 

Nếu máy in không nhận lệnh in hoặc có thể xảy ra trường hợp nhận lệnh in nhưng không in được mặc dù trước đó máy in vẫn hoạt động một cách bình thường thì có khả năng là do phần mềm hoạt động giải trí của hệ điều hành quản lý máy tính. Một số lỗi phổ biến có thể kể đến như:

  • Do đường truyền kết nối giữa máy in và máy tính bị mất.
  • Do máy in đang ở chế độ offline.
  • Do dịch vụ Print Spooler ở máy tính bị lỗi.
  • Do máy tính gặp vấn đề với driver máy in.
  • Do giấy trong máy in của bạn bị kẹt nên sẽ báo lỗi và không hoàn thành được quá trình in.
  • Do máy in của bạn chưa nhận hộp mực.
  • Do load giấy ở máy in bị mòn khiến cho máy in không kéo giấy lên được.
  • Do khay để giấy trong máy in bị hết giấy.
  • Do máy in bị kẹt lệnh ở máy tính.

Lỗi máy in không in được qua mạng Lan, wifi

Trong trường hợp máy in được kết nối với mạng Lan hoặc sử dụng wifi để in thì có thể gặp phải tình trạng không in được vì nguyên nhân chính sau:

  • Do máy in thay đổi địa chỉ ip.
  • Do tên wifi hoặc pass của wifi mà máy in kết nối bị thay đổi.
  • Do máy in bị mất kết nối với máy tính chủ sử dụng chung mạng Lan.

Lỗi máy in không in được do hư phần cứng

Trường hợp máy in của bạn có tuổi đời cao thì những linh kiện bên trong máy in có thể bị xuống cấp dẫn đến tình trạng hư hỏng. Một số linh kiện làm khiến máy in có thể không in được như:

  • Mainboard Formatter bị hỏng. 
  • Dây cáp kết nối máy in bị đứt. 
  • Cụm sấy máy in bị hao mòn và bao lụa dẫn đến kẹt giấy không in được.

>> Nếu máy in của bạn bị hỏng và có nhu cầu thanh lý thì hãy tham khảo các đơn vị thu mua dưới đây nhé:

  • Đơn vị  thu mua máy in.
  • Đơn vị  thu mua đồ văn phòng cũ.

Do lỗi hệ điều hành đang sử dụng 

Trước hết, người sử dụng nhấn chọn tổ hợp phím Windows + R, ở dòng OPEN hãy nhập vào dòng chữ ”services.msc” và nhấn OK/ENTER.

Các nguyên nhân máy in không in được
Sửa lỗi máy in do lỗi hệ điều hành

Tiếp đó, khi xuất hiện cửa sổ “Services” trên màn hình máy tính, người dùng tiếp tục tìm kiếm tiến trình “Print Spooler” và nhấn chọn “Restart” để khởi động lại. 

Các nguyên nhân máy in không in được
Sửa lỗi máy in do lỗi hệ điều hành

Cuối cùng, sau khi thực hiện xong các bước ở trên, người dùng có thể thực hiện lại quá trình in ấn để kiểm tra xem lỗi máy in không in được đã được xử lý hay chưa. Nếu chưa bạn có thể áp dụng các cách  sửa lỗi không in được máy in tiếp theo.

Lỗi do dây cable kết nối có thể gây nên tình trạng  máy in lỗi không in được

Đối với tình huống dây cable kết nối bị hỏng, bị đứt hoặc cắm bị lỏng không thể kết nối máy tính với máy in. 

Dây cable là một trong những vấn đề mà người dùng nên thường xuyên kiểm tra vì có nhiều tác động vật lý có thể ảnh hưởng đến như có người dẫm lên, chuột cắn…có khả năng bị đứt mạch làm ảnh hưởng đến quá trình truyền tải dữ liệu. 

Vậy cách sửa lỗi máy in khi không in được như thế nào? Cách đơn giản nhất để kiểm tra xem dây cable hỏng hay chưa là bạn sử dụng một sợi dây mới để chạy thử. Nếu dây cable mới chạy ổn thì chứng tỏ sợi dây cable cũ của bạn đã có vấn đề.

Các nguyên nhân máy in không in được
Dây Cable kết nối

Lỗi chưa bật nguồn máy in

Một số trường hợp máy in không in được do người dùng chưa bật máy in hoặc rắc cắm chưa được kết nối với nguồn điện. Chính vì vậy, trước khi thực hiện in bạn nên kiểm tra các dây kết nối.

Các nguyên nhân máy in không in được
Lỗi chưa bật nguồn máy in

Do lỗi IP trên máy in có thể gây nên  lỗi không in được máy in

Có rất nhiều tình huống xảy ra ví dụ như mất điện hoặc mất mạng hoặc do máy bạn vừa cài đặt lại IP mới, mọi chia sẻ về kết nối sẽ bị thay đổi do IP thay đổi. Lúc này bạn chỉ cần chia sẻ lại máy in cho những người xung quanh. 

Bước 1: Chọn biểu tượng mạng như hình minh họa dưới đây => chọn OPEN Network and Sharing Center  

Các nguyên nhân máy in không in được
chọn OPEN Network and Sharing Center

Bước 2: Bạn chọn Change Adapter Settings để có quyền truy cập vào phần Local Area Connection.

Các nguyên nhân máy in không in được
chọn Change Adapter Settings để có quyền truy cập vào phần Local Area Connection

Bước 3: Khi xuất hiện hộp thoại: chuột phải vào Local Area Connection và ấn chọn Properties.

Các nguyên nhân máy in không in được
chuột phải vào Local Area Connection và ấn chọn Properties.

Bước 4: Nhấn chọn Internet Protocol Version 4 (TCP/IPv4) để tiếp tục chỉnh sửa địa chỉ IP.

Các nguyên nhân máy in không in được
Internet Protocol Version 4 (TCP/IPv4)

Bước 5: Click vào Obtain an IP address automatically để đặt IP tự động.

Các nguyên nhân máy in không in được
Click vào Obtain an IP address automatically

Để Windows tự tìm lỗi sửa giúp bạn 

Người dùng có thể sửa lỗi máy in không in được bằng cách để Windows tự tìm lỗi sửa bằng Troubleshoot. 

Bước 1: Chọn Start Menu trên máy tính và tìm kiếm & khởi chạy Control Panel.

Các nguyên nhân máy in không in được
Chọn Start Menu trên máy tính và tìm kiếm & khởi chạy Control Panel

Bước 2: Sau khi mở được cửa sổ  Hardware and Sound, bạn chỉ cần nhấn chọn View devices and printers.

Các nguyên nhân máy in không in được
nhấn chọn View devices and printers.

Bước 3: Tiếp tục nhấn chuột phải vào thiết bị máy in mà bạn cần xử lý  lỗi > Chọn Troubleshoot.

Các nguyên nhân máy in không in được
Chọn Troubleshoot.

Bước 4: Sau đó hệ thống Windows trong máy tính của bạn sẽ tự động kiểm tra lại toàn bộ trật tự và giải quyết lỗi. Đây là một trong những cách khá đơn giản và dễ dùng.

Các nguyên nhân máy in không in được
hệ thống Windows trong máy tính của bạn sẽ tự động kiểm tra lại toàn bộ trật tự và giải quyết lỗi

Bước 5: Nhấn chọn Apply this fix khi xuất hiện thông báo.

Các nguyên nhân máy in không in được
chọn Apply this fix

Bước 6: Nếu bạn thấy xuất hiện dấu tick màu xanh thông báo quá trình sửa lỗi máy in không nhận lệnh in đã thành công. 

Các nguyên nhân máy in không in được
dấu tick màu xanh thông báo quá trình sửa lỗi máy in không nhận lệnh in đã thành công

Cách sửa lỗi máy in đã nhận lệnh nhưng không in được 

Kiểm tra lại cable kết nối máy in 

Nếu cable kết nối của bạn có vấn đề thì bạn có thể thay bằng một dây mới sẽ nhanh và hiệu quả hơn trong quá trình sửa chữa, giúp máy in chạy tốt hơn và hạn chế các vấn đề liên quan đến dây cable kết nối.

Các nguyên nhân máy in không in được
Kiểm tra lại cable kết nối máy in

Có quá nhiều lệnh in trong máy 

Đây là một trong những vấn đề thường xuyên xảy ra, đặc biệt là ở các công ty lớn có máy in sử dụng chung, có nhiều lệnh in dẫn đến tình trạng máy in chưa kịp load lệnh in.

Vậy cách sửa máy in không nhận lệnh như thế nào? Để giải quyết tình huống này, người dùng có thể thực hiện theo các bước dưới đây: &lt;/p&gt; &lt;p&gt;Bước 1: Chọn Menu Start và mở mục “Control panel”, sau đó truy cập vào mục này.&lt;/p&gt; &lt;div style="text-align:center"&gt; &lt;figure class="image" style="display:inline-block"&gt;&lt;img alt="cách khắc phục lỗi không in được máy in" src="https://musk.vn/uploads/files/blog/loi-may-in-khong-in-duoc/cach-khac-phuc-loi-khong-in-duoc-may-in.jpg" style="width:600px"&gt; &lt;figcaption&gt;Chọn Menu Start và mở mục “Control panel”&lt;/figcaption&gt; &lt;/figure&gt; &lt;/div&gt; &lt;p&gt;Bước 2: Tiếp đó, bạn chỉ cần chọn máy in bị lỗi rồi click chuột phải chọn See what’s printing.&lt;/p&gt; &lt;div style="text-align:center"&gt; &lt;figure class="image" style="display:inline-block"&gt;&lt;img alt="cách khắc phục máy in lỗi không in được" src="https://musk.vn/uploads/files/blog/loi-may-in-khong-in-duoc/cach-khac-phuc-may-in-loi-khong-in-duoc.jpg" style="width:600px"&gt; &lt;figcaption&gt;click chuột phải chọn See what’s printing&lt;/figcaption&gt; &lt;/figure&gt; &lt;/div&gt; &lt;p&gt;Bước 3: Người dùng có thể lựa chọn xóa toàn bộ Cancel All Documents hoặc xóa từng phần một.&lt;/p&gt; &lt;div style="text-align:center"&gt; &lt;figure class="image" style="display:inline-block"&gt;&lt;img alt="hướng dẫn cách khắc phục máy in không nhận lệnh in" src="https://musk.vn/uploads/files/blog/loi-may-in-khong-in-duoc/huong-dan-cach-khac-phuc-may-in-khong-nhan-lenh-in.jpg" style="width:600px"&gt; &lt;figcaption&gt;chọn xóa toàn bộ Cancel All Documents hoặc xóa từng phần một&lt;/figcaption&gt; &lt;/figure&gt; &lt;/div&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;div style="text-align:center"&gt; &lt;figure class="image" style="display:inline-block"&gt;&lt;img alt="hướng dẫn cách khắc phục máy in bị lỗi không in được" src="https://musk.vn/uploads/files/blog/loi-may-in-khong-in-duoc/huong-dan-cach-khac-phuc-may-in-bi-loi-khong-in-duoc.jpg" style="width:600px"&gt; &lt;figcaption&gt;chọn xóa toàn bộ Cancel All Documents hoặc xóa từng phần một&lt;/figcaption&gt; &lt;/figure&gt; &lt;/div&gt; &lt;h3&gt;&lt;strong&gt;Máy in đang ở chế độ offline&amp;nbsp;&lt;/strong&gt;&lt;/h3&gt; &lt;p&gt;Có nhiều tình huống bạn ấn nhầm hoặc máy tính gặp lỗi nên máy in bị đặt về trạng thái offline.&amp;nbsp;&lt;/p&gt; &lt;div style="text-align:center"&gt; &lt;figure class="image" style="display:inline-block"&gt;&lt;img alt="hướng dẫn cách khắc phục lỗi không in được máy in" src="https://musk.vn/uploads/files/blog/loi-may-in-khong-in-duoc/huong-dan-cach-khac-phuc-loi-khong-in-duoc-may-in.jpg" style="width:600px"&gt; &lt;figcaption&gt;Máy in đang ở chế độ offline&lt;/figcaption&gt; &lt;/figure&gt; &lt;/div&gt; &lt;p&gt;Hình ảnh trên là ví dụ bạn có thể nhận biết máy tính của mình đang ở trạng thái nào: Offline hay online. Nếu máy tính của bạn hiển thị đang ở trạng thái offline thì bạn chỉ cần chọn Printer và bỏ dấu tích “Use Printer Offline” là hoàn thành.&amp;nbsp;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&amp;gt;&amp;gt;&amp;gt; Xem thêm các lỗi liên quan:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a target="_blank" href="https://musk.vn/tin-tuc/may-tinh-khong-nhan-may-in.html"&gt;Máy in không nhận máy tính&lt;/a&gt; sửa như thế nào?&lt;/li&gt; &lt;li&gt;&lt;a target="_blank" href="https://musk.vn/tin-tuc/sua-loi-may-in-nhan-lenh-nhung-khong-in.html"&gt;Cách sửa lỗi máy in nhận lệnh nhưng không in&lt;/a&gt; đơn giản&lt;/li&gt; &lt;/ul&gt; &lt;/blockquote&gt; &lt;h3&gt;&lt;strong&gt;Khởi động lại máy in&lt;/strong&gt;&lt;/h3&gt; &lt;p&gt;Trong trường hợp bạn không biết nguyên nhân máy in không in được là do đâu thì lựa chọn sáng suốt nhất là khởi động lại máy in của mình.&lt;/p&gt; &lt;p&gt;Để khởi động lại máy in, người dùng có thể chọn 1 trong 2 cách sau:&lt;/p&gt; &lt;blockquote cite="https://tinyurl.com/yuk2u52b#huong-dan-cach-sua-loi-may-in-khong-in-duoc"&gt; &lt;ul&gt; &lt;li&gt;Cách 1: Tắt và bật nguồn điện trên thiết bị để sửa máy in.&lt;/li&gt; &lt;li&gt;Cách 2: mở lại máy in trên Windows.&lt;/li&gt; &lt;/ul&gt; &lt;/blockquote&gt; &lt;p&gt;Qua bài viết trên, &lt;a target="_blank" href="https://www.google.com/search?q=muskvn+website+dang+tin+dich+vu+mien+phi&amp;kponly=&amp;kgmid=/g/11j7yf2kzq"&gt;Musk.vn&lt;/a&gt; hy vọng bạn sẽ có thêm nhiều hiểu biết để sửa lỗi máy in.&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="col-md-3 col-xs-12 sidebar-company"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/section&gt; &lt;/main&gt; &lt;div id="modalImage" class="modalImage"&gt; &lt;img id="modalImage-content" class="modalImage-content"&gt; &lt;div id="modalImage-close" class="modalImage-close"&gt;&lt;/div&gt; &lt;div id="modalImage-caption" class="modalImage-caption"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" style="z-index:10000"&gt; &lt;div class="modal-dialog modal-lg"&gt; &lt;div class="modal-content"&gt; &lt;div class="modal-header"&gt; &lt;h5 class="modal-title" id="exampleModalLabel"&gt;Hướng dẫn sử dụng chức năng báo giá&lt;/h5&gt; &lt;button type="button" class="btn btn-danger btn-sm" data-dismiss="modal" aria-label="Close"&gt; &lt;span aria-hidden="true"&gt;×&lt;/span&gt; &lt;/button&gt; &lt;/div&gt; &lt;div class="modal-body"&gt; Đang cập nhật... &lt;/div&gt; &lt;div class="modal-footer"&gt; &lt;button type="button" class="btn btn-secondary" data-dismiss="modal"&gt;Đóng&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="login-register-password" class="CRVer_3"&gt; &lt;div class="tab_container_login active-popup-login CRtab_log_pc active-popup-registry"&gt; &lt;div class="form-wrapper"&gt; &lt;div class="intro_log"&gt; &lt;a class="btn_backClose"&gt;&lt;span&gt;&lt;i class="fa fa-angle-left" aria-hidden="true"&gt;&lt;/i&gt;Trở về&lt;/span&gt;&lt;/a&gt; &lt;div class="content"&gt; &lt;img alt="MuskVn" class="lazyloaded" src="https://musk.vn/web/musk/common/images/3227420-1.png"&gt; &lt;h3&gt;Kết nối dễ dàng - muôn vàn dịch vụ&lt;/h3&gt; &lt;p&gt;Dù bạn ở đâu chỉ cần có internet Musk.vn sẽ giúp bạn kết nối với hàng trăm dịch vụ chỉ với vài cái chạm tay&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="all_tab_log CRfix_error_mes"&gt; &lt;div id="tab1_login" class="default_login tab_content_login"&gt; &lt;div class="content"&gt; &lt;div class="right"&gt; &lt;div class="cont"&gt; &lt;div class="CRsame_cont_tab_log"&gt; &lt;div class="login__logo"&gt; &lt;image class="login__logo-img" src="https://musk.vn/web/musk/common/images/img.png"&gt; &lt;p class="login__logo-text"&gt;MUSK VIỆT NAM&lt;/p&gt; &lt;/image&gt;&lt;/div&gt; &lt;/div&gt; &lt;h3&gt;Đăng nhập&lt;/h3&gt; &lt;p class="cont_def"&gt;Sử dụng thông tin đăng nhập của bạn để truy cập&lt;/p&gt; &lt;form action="#" id="form-login" class="login__form"&gt; &lt;div class="mb-3 login__form-item"&gt; &lt;label class="form-label login__form-text"&gt;Tài khoản&lt;/label&gt; &lt;input type="email" placeholder="Số điện thoại/Email" class="form-control input-first login__form-input"&gt; &lt;/div&gt; &lt;div class="mb-3 login__form-item"&gt; &lt;label class="form-label login__form-text"&gt;Mật khẩu&lt;/label&gt; &lt;input id="password-field" type="password" placeholder="Nhập mật khẩu của bạn" class="form-control input-second login__form-input" name="password"&gt; &lt;span toggle="#password-field" class="fa fa-fw fa-eye login__form-icon toggle-password"&gt;&lt;/span&gt; &lt;/div&gt; &lt;button id="button--submit" type="submit" class="login__form-button"&gt;Đăng nhập&lt;/button&gt; &lt;/form&gt; &lt;a target="_blank" href="https://musk.vn/tin-tuc/loi-may-in-khong-in-duoc.html#" class="login__form-subtext mt-2"&gt;Quên mật khẩu&lt;/a&gt; &lt;div class="login__social"&gt; &lt;div class="login__social-groupline"&gt; &lt;div class="login__social-line"&gt;&lt;/div&gt; &lt;p class="login__social-text"&gt;Hoặc đăng nhập với&lt;/p&gt; &lt;div class="login__social-line"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="login__social-group"&gt; &lt;a class="btn btn-primary login__social-button login__social-button-fb"&gt;&lt;img src="https://musk.vn/web/musk/common/images/img.png"&gt;&lt;span&gt;Facebook&lt;/span&gt;&lt;/a&gt; &lt;a class="btn btn-primary login__social-button login__social-button-gg"&gt;&lt;img src="https://musk.vn/web/musk/common/images/img.png"&gt;&lt;span&gt;Google&lt;/span&gt;&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="wrap_switch_tab"&gt; &lt;div class="cont_switch"&gt; &lt;p&gt;Bạn chưa có tài khoản?&lt;/p&gt; &lt;a class="CRbtn_switch" data-type="reg"&gt;Đăng ký&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="tab2_login" class="default_login tab_content_registry visiable-hidden"&gt; &lt;div class="content"&gt; &lt;div class="right"&gt; &lt;div class="cont"&gt; &lt;div class="CRsame_cont_tab_log"&gt; &lt;div class="login__logo"&gt; &lt;image class="login__logo-img" src="https://musk.vn/web/musk/common/images/img.png"&gt; &lt;p class="login__logo-text"&gt;MUSK VIỆT NAM&lt;/p&gt; &lt;/image&gt;&lt;/div&gt; &lt;/div&gt; &lt;h3&gt;Đăng ký&lt;/h3&gt; &lt;p class="cont_def"&gt;Tạo tài khoản mới trong vòng 1 phút.&lt;/p&gt; &lt;form action="#" id="form-register" class="login__form"&gt; &lt;div class="mb-3 login__form-item"&gt; &lt;label class="form-label login__form-text"&gt;Số điện thoại&lt;/label&gt; &lt;input type="text" placeholder="Nhập số điện thoại của bạn...." class="form-control input-first-res login__form-input"&gt; &lt;div class="register__group"&gt; &lt;input id="captchaTextBox" type="text" placeholder="Nhập mã capcha" class="form-control input-second-res login__form-input register__input"&gt; &lt;div class="register__captcha captcha_text"&gt; &lt;div id="captcha"&gt;&lt;/div&gt; &lt;img id="captchaImg" src="" alt="Geben sie die im Bild dargestellte Zeichenfolge ein"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;button id="button--register" type="submit" class="login__form-button"&gt;Đăng ký&lt;/button&gt; &lt;/form&gt; &lt;div class="login__social"&gt; &lt;div class="login__social-groupline"&gt; &lt;div class="login__social-line"&gt;&lt;/div&gt; &lt;p class="login__social-text"&gt;Hoặc đăng ký với&lt;/p&gt; &lt;div class="login__social-line"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="login__social-group"&gt; &lt;a class="btn btn-primary login__social-button login__social-button-fb"&gt;&lt;img src="https://musk.vn/web/musk/common/images/img.png"&gt;&lt;span&gt;Facebook&lt;/span&gt;&lt;/a&gt; &lt;a class="btn btn-primary login__social-button login__social-button-gg"&gt;&lt;img src="https://musk.vn/web/musk/common/images/img.png"&gt;&lt;span&gt;Google&lt;/span&gt;&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="wrap_switch_tab"&gt; &lt;div class="cont_switch"&gt; &lt;p&gt;Bạn đã có tài khoản?&lt;/p&gt; &lt;a class="CRbtn_switch" data-type="log"&gt;Đăng nhập&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="bg_popup_login"&gt;&lt;/div&gt; &lt;/div&gt; &lt;footer class="pt-40 pb-40"&gt; &lt;div class="wraper"&gt; &lt;div class="row"&gt; &lt;div class="col-12 col-md-3"&gt; &lt;h4 class="ttl_f"&gt;THÔNG TIN LIÊN HỆ&lt;/h4&gt; &lt;div class="content_f mt-20"&gt; &lt;ul&gt; &lt;li class="mt-5"&gt; Công Ty Cổ Phần Nền Tảng Đại Dương Xanh&lt;/li&gt; &lt;li class="mt-5"&gt;Địa chỉ: 71 Dương Văn Cam, P.Linh Tây, TP.Thủ Đức, TPHCM&lt;/li&gt; &lt;li class="mt-5"&gt;Điện thoại: 0904140007&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="col-12 col-md-3"&gt; &lt;h4 class="ttl_f"&gt;VỀ MUSK VIỆT NAM&lt;/h4&gt; &lt;div class="content_f mt-20"&gt; &lt;ul&gt; &lt;li class="mt-10"&gt;&lt;a target="_blank" href="https://musk.vn/gioi-thieu.html"&gt;Giới thiệu&lt;/a&gt;&lt;/li&gt; &lt;li class="mt-10"&gt;&lt;a target="_blank" href="https://musk.vn/lien-he.html"&gt;Liên hệ&lt;/a&gt;&lt;/li&gt; &lt;li class="mt-10"&gt;&lt;a target="_blank" href="https://musk.vn/tin-tuc"&gt;Tin tức&lt;/a&gt;&lt;/li&gt; &lt;li class="mt-10"&gt;&lt;a target="_blank" href="https://musk.vn/doanh-nghiep-tp-ho-chi-minh"&gt;Doanh nghiệp&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="col-12 col-md-3"&gt; &lt;h4 class="ttl_f"&gt;HỖ TRỢ KHÁCH HÀNG&lt;/h4&gt; &lt;div class="content_f mt-20"&gt; &lt;ul&gt; &lt;li class="mt-10"&gt;&lt;a target="_blank" href="https://musk.vn/dieu-khoan-su-dung.html"&gt;Điều khoản sử dụng&lt;/a&gt;&lt;/li&gt; &lt;li class="mt-10"&gt;&lt;a target="_blank" href="https://musk.vn/chinh-sach-bao-mat-thong-tin.html"&gt;Chinh sách bảo mật thông tin&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div class="content flexBox midle mt-20" style="padding-left:0px!important"&gt; &lt;h4 class="ttl_f"&gt;KẾT NỐI VỚI CHÚNG TÔI&lt;/h4&gt; &lt;ul class="flexBox socail_f ml-15"&gt; &lt;li&gt;&lt;a href="https://www.youtube.com/channel/UC8pxUenBS1pPpx-K-DZ4bqg" target="_blank"&gt; &lt;img src="https://musk.vn/uploads/files/struction/icons8_youtube_squared%201.png" alt=""&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="https://www.facebook.com/muskvn1" target="_blank"&gt; &lt;img src="https://musk.vn/uploads/files/struction/icons8_facebook%201.png" alt=""&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="https://zalo.me/4038738003916640748" target="_blank"&gt; &lt;img src="https://musk.vn/uploads/files/struction/icons8_zalo%201.png" alt=""&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="col-12 col-md-3"&gt; &lt;h4 class="ttl_f"&gt;CHỨNG NHẬN BỞI&lt;/h4&gt; &lt;div class="content flexBox midle mt-20"&gt; &lt;div&gt; &lt;a href="http://online.gov.vn/Home/WebDetails/83181" target="_blank"&gt; &lt;img class="bo-cong-thuong" src="https://musk.vn/web/musk/img/bo_cong_thuong_da_dang_ky.png"&gt; &lt;/a&gt; &lt;/div&gt; &lt;div&gt; &lt;a href="https://tinnhiemmang.vn/danh-ba-tin-nhiem/muskvn-1658803027" title="Chung nhan Tin Nhiem Mang" target="_blank"&gt;&lt;img src="https://tinnhiemmang.vn/handle_cert?id=musk.vn" width="150px" height="auto" alt="Chung nhan Tin Nhiem Mang"&gt; &lt;/a&gt; &lt;/div&gt; &lt;div style="margin-left:5px"&gt; &lt;a href="https://www.dmca.com/Protection/Status.aspx?ID=eaf5bbb8-33d8-4377-8cc2-81774b62df4f" title="DMCA.com Protection Status" class="dmca-badge" target="_blank"&gt; &lt;img class="dmca" src="https://images.dmca.com/Badges/_dmca_premi_badge_2.png?ID=eaf5bbb8-33d8-4377-8cc2-81774b62df4f" alt="DMCA.com Protection Status"&gt; &lt;/a&gt; &lt;script src="https://images.dmca.com/Badges/DMCABadgeHelper.min.js"&gt; &lt;/script&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;div class="col"&gt; &lt;p class="copyright"&gt;@2022 Bản quyền của Công Ty Cổ Phần Nền Tảng Đại Dương Xanh&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;&lt;/footer&gt; &lt;button type="button" id="btnViewAllImage" style="display:none" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#viewAllImage"&gt;&lt;/button&gt; &lt;div class="modal fade" id="viewAllImage" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" style="margin-top:110px"&gt; &lt;div class="modal-dialog modal-lg"&gt; &lt;div class="modal-content"&gt; &lt;div class="modal-body" id="thumbnail-display-image"&gt; &lt;button style="position:absolute;top:5px;right:5px" type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"&gt;&lt;/button&gt; &lt;div style="padding:15px"&gt; &lt;div&gt; &lt;div class="thumb-display-container" id="listImageLarge"&gt; &lt;div class="row mt-5" id="listImageMini"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;style&gt; .imageQuote { height: 50px; } .imageQuoteBtn { position: relative; padding: 0px; } .imageQuoteBtn .close { position: absolute; top: -8px; right: 1px; z-index: 100; color: #FFFFFF; font-size: 20px; } .button-jittery .btn-clickme { animation: jittery 4s infinite; } /*.button-jittery .btn-clickme:hover {*/ /* animation: heartbeat 0.2s infinite;*/ /*}*/ @keyframes jittery { 5%, 50% { transform: scale(1); } 10% { transform: scale(0.9); } 15% { transform: scale(1.15); } 20% { transform: scale(1.15) rotate(-5deg); } 25% { transform: scale(1.15) rotate(5deg); } 30% { transform: scale(1.15) rotate(-3deg); } 35% { transform: scale(1.15) rotate(2deg); } 40% { transform: scale(1.15) rotate(0); } } @keyframes heartbeat { 50% { transform: scale(1.1); } } .btn-clickme { background: transparent; color: #fff; border: 3px solid #fff; border-radius: 50px; padding: 5px 20px; font: 18px "Margarine", sans-serif; outline: none; cursor: pointer; position: relative; transition: 0.2s ease-in-out; letter-spacing: 2px; } .bubble { position: absolute; right: 137px; bottom: 56px; width: 300px; padding: 20px; background-color: #3357AF; -webkit-border-radius: 20px; -moz-border-radius: 20px; border-radius: 20px; color: #FFFFFF; font-weight: 600; } .bubble:before { content: ""; position: absolute; padding: 7px 15px; bottom: -14px; right: -2px; background-color: #3357AF; border-bottom-left-radius: 30px 20px; } .bubble:after { content: ""; position: absolute; padding: 7px 15px; bottom: -14px; right: -12px; background-color: white; border-bottom-left-radius: 30px 20px; } .musk-box-chat { position: fixed; right: 0px; bottom: 0px; z-index: 100; } .musk-box-chat .pic { width: 40px; height: 40px; background-size: cover; background-position: center; /*border-radius: 50%;*/ } .musk-box-chat .contact { position: relative; margin-bottom: 1rem; padding-left: 55px; height: 40px; display: flex; flex-direction: column; justify-content: center; } .musk-box-chat .contact .pic { position: absolute; left: 0; } .musk-box-chat .contact .name { font-weight: 500; /*margin-bottom: 0.125rem;*/ text-overflow: ellipsis; width: 100%; overflow: hidden; white-space: nowrap; font-weight: bold; font-size: 14px; } .musk-box-chat .contact .message, .musk-box-chat .contact .seen { font-size: 0.9rem; color: #999; } .musk-box-chat .contact .badge { box-sizing: border-box; position: absolute; width: 20px; height: 20px; /* text-align: center; */ font-size: 12px; /* padding-top: 4px; */ border-radius: 50%; top: 0; left: 37px; background: #333; color: white; padding: 4px; } .musk-box-chat .contacts { position: absolute; bottom: -225px; left: 0; transform: translate(-70px, -225px); width: 400px; height: 450px; padding: 1rem 2rem 1rem 1rem; box-sizing: border-box; border-radius: 1rem 0 0 1rem; cursor: pointer; background: white; box-shadow: 0 0 8rem 0 rgb(0 0 0 / 10%), 2rem 2rem 4rem -3rem rgb(0 0 0 / 50%); transition: transform 500ms; } .musk-box-chat .contacts #list-contact{ overflow-y: scroll; height: 350px; padding: 10px 0px; } .musk-box-chat .contacts #list-contact .active{ border-radius: 5px; background-color: #3357AF; color: white; } .musk-box-chat .contacts #list-contact .message{ font-size: 12px; text-overflow: ellipsis; width: 100%; } .musk-box-chat .contacts h2 { margin: 9px 0px 22px 55px } .musk-box-chat .contacts .fa-bars { position: absolute; left: 27px; color: #999; transition: color 200ms; margin-top: 10px; } .musk-box-chat .contacts .fa-bars:hover { color: #666; } .musk-box-chat .contacts .contact:last-child { margin: 0; } .musk-box-chat .contacts:hover { transform: translate(-23rem, -50%); } .musk-box-chat .chat { position: relative; display: flex; flex-direction: column; /*justify-content: space-between;*/ /*width: 24rem;*/ /*height: 38rem;*/ width: 350px; height: 450px; z-index: 2; box-sizing: border-box; border-radius: 1rem; background: white; box-shadow: 0 0 8rem 0 rgba(0, 0, 0, 0.1), 0rem 2rem 4rem -3rem rgba(0, 0, 0, 0.5); } .musk-box-chat .chat .contact.bar { flex-basis: 3.5rem; flex-shrink: 0; margin: 5px; box-sizing: border-box; } .musk-box-chat .chat .messages { padding: 0px 10px; background: #f7f7f7; flex-shrink: 2; overflow-y: auto; box-shadow: inset 0 2rem 2rem -2rem rgba(0, 0, 0, 0.05), inset 0 -2rem 2rem -2rem rgba(0, 0, 0, 0.05); height: 100%; } .musk-box-chat .chat .messages .time { font-size: 0.8rem; background: #eee; padding: 0.25rem 1rem; border-radius: 2rem; color: #999; width: -webkit-fit-content; width: -moz-fit-content; width: fit-content; margin: 0 auto; } .musk-box-chat .chat .messages .message { box-sizing: border-box; padding: 0.5rem 1rem; margin: 1rem; background: #fff; border-radius: 1.125rem 1.125rem 1.125rem 0; min-height: 2.25rem; width: -webkit-fit-content; width: -moz-fit-content; width: fit-content; max-width: 66%; box-shadow: 0 0 2rem rgba(0, 0, 0, 0.075), 0rem 1rem 1rem -1rem rgba(0, 0, 0, 0.1); white-space: break-spaces; } .musk-box-chat .chat .messages .message.parker { margin: 1rem 1rem 1rem auto; border-radius: 1.125rem 1.125rem 0 1.125rem; background: #333; color: white; } .musk-box-chat .chat .messages .message .typing { display: inline-block; width: 0.8rem; height: 0.8rem; margin-right: 0rem; box-sizing: border-box; background: #ccc; border-radius: 50%; } .musk-box-chat .chat .messages .message .typing.typing-1 { -webkit-animation: typing 3s infinite; animation: typing 3s infinite; } .musk-box-chat .chat .messages .message .typing.typing-2 { -webkit-animation: typing 3s 250ms infinite; animation: typing 3s 250ms infinite; } .musk-box-chat .chat .messages .message .typing.typing-3 { -webkit-animation: typing 3s 500ms infinite; animation: typing 3s 500ms infinite; } .musk-box-chat .chat .input { box-sizing: border-box; flex-basis: 4rem; flex-shrink: 0; display: flex; align-items: center; padding: 0 0.5rem 0 1.5rem; } .musk-box-chat .chat .input i { font-size: 1.5rem; margin-right: 1rem; color: #666; cursor: pointer; transition: color 200ms; } .musk-box-chat .chat .input i:hover { color: #333; } .musk-box-chat .chat .input input { border: none; background-image: none; background-color: white; padding: 0.5rem 1rem; margin-right: 1rem; border-radius: 1.125rem; flex-grow: 2; box-shadow: 0 0 1rem rgba(0, 0, 0, 0.1), 0rem 1rem 1rem -1rem rgba(0, 0, 0, 0.2); font-family: Red hat Display, sans-serif; font-weight: 400; letter-spacing: 0.025em; } .musk-box-chat .chat .input input:placeholder { color: #999; } @-webkit-keyframes typing { 0%, 75%, 100% { transform: translate(0, 0.25rem) scale(0.9); opacity: 0.5; } 25% { transform: translate(0, -0.25rem) scale(1); opacity: 1; } } @keyframes typing { 0%, 75%, 100% { transform: translate(0, 0.25rem) scale(0.9); opacity: 0.5; } 25% { transform: translate(0, -0.25rem) scale(1); opacity: 1; } } .musk-box-chat .pic.stark { background-image: url("https://musk.vn/web/img/user_icon.png"); } .musk-box-chat .pic.quote { background-image: url("https://musk.vn/web/img/quote-icon.png"); } /* width */ .musk-box-chat ::-webkit-scrollbar { width: 8px; } /* Track */ .musk-box-chat ::-webkit-scrollbar-track { background: #f1f1f1; } /* Handle */ .musk-box-chat ::-webkit-scrollbar-thumb { background: #888; } /* Handle on hover */ .musk-box-chat ::-webkit-scrollbar-thumb:hover { background: #555; } #request_quote_history p { margin-bottom: 0px; } .mess-system { color: red; } #show_box_style { display: none; } @media only screen and (max-width: 768px) { #show_box_style { display: block; } .musk-box-chat .contacts:hover { transform: translate(-70px, -225px); } .musk-box-chat .contacts { height: 60vh; width:100vw; } .musk-box-chat .chat { height: 60vh; width: calc(100vw - 70px); } .bubble { right: 80px; font-size: 12px; } .btn-clickme { font-size: 14px; } } @media only screen and (max-width: 414px) { .bubble { right: 40px; font-size: 12px; } .btn-clickme { font-size: 14px; } } .bubble-close { position: absolute; top: 10px; right: 15px; color: #333; cursor: pointer; } </p><div class="musk-box-chat" id="open_chat_box" style="bottom:5px;right:5px;display:none"> <div id="bubble-speech" class="bubble"> <span class="bubble-close"><i class="fa fa-times" style="font-size:20px" aria-hidden="true"></i></span> Bạn có thể gửi tin nhắn yêu cầu báo giá đến nhiều nhà cung cấp cùng 1 lúc . Thử ngay !!! <br> <div class="item button-jittery" style="--bg-color:#f1c40f;text-align:center;margin-top:20px"> <button data-toggle="modal" data-target="#exampleModal" class="btn-clickme">Hướng dẫn</button> </div> </div> <button class="btn btn-success" id="btn_open_chat_box">Yêu cầu báo giá</button> </div> <div class="musk-box-chat" id="musk_box_chat" style="display:none"> <div id="content-contact-id" class="contacts"> <i class="fa fa-bars"></i> <h2> Doanh nghiệp </h2> <hr style="margin-bottom:0px"> <div id="list-contact"> </div> </div> <div id="content-chat-id" class="chat"> <div class="contact bar"> <div class="pic"><img id="box-room-image" style="object-fit:cover;width:40px;height:40px;border-radius:5px" src=""> </div> <div class="name" id="box-room-name" style="overflow:hidden;text-overflow:ellipsis;width:calc(100% - 70px)"> Tony Stark </div> <div id="box-room-more-info" class="seen" style="width:calc(100% - 70px);text-overflow:ellipsis;overflow:hidden;white-space:nowrap"> </div> <div style="display:flex;position:absolute;right:10px;top:15px;color:black;cursor:pointer"> <i style="width:25px;background-color:#0b308a;color:white;margin-right:5px;padding:5px;border-radius:5px" class="fa fa-question-circle-o" aria-hidden="true" data-toggle="modal" data-target="#exampleModal"></i> <i style="width:25px;background-color:#0b308a;color:white;margin-right:5px;padding:5px;border-radius:5px" class="fa fa-window-minimize" aria-hidden="true" id="minimize_box_chat"></i> <i style="width:25px;background-color:#0b308a;color:white;padding:5px;border-radius:5px" class="fa fa-window-maximize" aria-hidden="true" id="show_box_style"></i> </div> </div> <div class="messages" id="request_quote_content" style="display:none"> <div style="font-size:12px"> <p style="padding-top:10px">Không thẻ gửi báo giá vì chưa có doanh nghiệp nào kết nối tính năng gửi báo giá. Chúng tôi xin lỗi vì bất tiện này. Để tìm hiểu thêm vui lòng liên hệ Hotline</p> <p class="text-center" style="position:sticky;top:0px;background:#f7f7f7"><b>Lịch sử yêu cầu báo giá</b></p> <div id="request_quote_history" style="white-space:break-spaces"> <p style="width:100%;text-align:center">Báo giá chờ duyệt nếu có sẽ xuất hiện ở đây</p> </div> </div> <div class="feedback"> <p class="text-center text-bold feedback_title"> Xin vui lòng bớt chút thời gian đóng góp ý kiến giúp Musk phục vụ bạn tốt hơn </p> <p class="feedback_question">Bạn đang không hài lòng về điểm nào của tính năng báo giá này?</p> <div class="form-check"> <input class="form-check-input" type="checkbox" value="1" name="feedbackCheckbox" id="flexCheck1"> <label class="form-check-label" for="flexCheck1"> Thái độ partner.. </label> </div> <div class="form-check"> <input class="form-check-input" type="checkbox" value="2" name="feedbackCheckbox" id="flexCheck2"> <label class="form-check-label" for="flexCheck2"> Thời gian báo giá </label> </div> <div class="form-check"> <input class="form-check-input" type="checkbox" value="3" name="feedbackCheckbox" id="flexCheck3"> <label class="form-check-label" for="flexCheck3"> Trải nghiệm trên web </label> </div> <div class="form-check"> <input class="form-check-input" type="checkbox" value="4" name="feedbackCheckbox" id="flexCheck4"> <label class="form-check-label" for="flexCheck4"> Hài lòng </label> </div> <div class="feedback_messager_form"> <p>Đóng góp ý kiến cải thiện tính năng</p> <textarea class="feedback_input"></textarea> </div> <button id="feedbackId" class="btn btn-success feedback_btn">Gửi</button> </div> </div> <div class="messages" id="chat-content" style="height:100%;overflow-x:hidden"> </div> <div class="input" id="input-message-data"> <input placeholder="Type your message here!" type="text" id="input-message"> <a class="ms-1 text-muted"><i class="fa fa-paperclip"></i></a> <i class="fa fa-paper-plane-o" id="submit-message"></i> <div id="loading-send-message" style="display:none"> <div class="spinner-border" role="status" style="width:20px;height:20px"> <span class="sr-only">Loading...</span> </div> </div> </div> <form id="formUpdateImageUser"> <input id="uploadImageUser" type="file" accept="image/*" name="image" style="display:none"> </form> <form id="formUpdateImageQuote1"> <input class="uploadImageQuote1" type="file" accept="image/*" name="image" style="display:none"> </form> <form id="formUpdateImageQuote2"> <input class="uploadImageQuote2" type="file" accept="image/*" name="image" style="display:none"> </form> <form id="formUpdateImageQuote3"> <input class="uploadImageQuote3" type="file" accept="image/*" name="image" style="display:none"> </form> <form id="formUpdateImageQuote4"> <input class="uploadImageQuote4" type="file" accept="image/*" name="image" style="display:none"> </form> </div> </div> <input type="hidden" id="baseUrl" name="baseUrl" value="https://musk.vn"> <script src="https://cdn.jsdelivr.net/npm//dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm//dist/js/bootstrap.bundle.min.js" integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF" crossorigin="anonymous"></script> <script src="https://musk.vn/web/musk/common/js/jquery.min.js"></script> <script src="https://musk.vn/web/musk/common/js/jquery.matchHeight-min.js"></script> <script src="https://musk.vn/web/musk/common/js/slick.js"></script> <script src="https://musk.vn/web/musk/common/js/popper.min.js"></script> <script src="https://musk.vn/web/musk/common/js/bootstrap.min.js"></script> <script src="https://musk.vn/web/musk/common/js/main.js"></script> <script src="https://musk.vn/web/musk/common/js/megamenu.js"></script> <script src="https://musk.vn/plugins/multi-select/multi-select.js"></script> <script src="https://musk.vn/web/js/custom.js?v=0.5"></script> <script src="https://musk.vn/assets/js/listImage.js"></script> <script src="https://musk.vn/assets/js/common.js"></script> <script src="https://musk.vn/web/musk/js/ver_1.js?v=0.5"></script> <script src="https://musk.vn/web/musk/js/ver_2.js?v=0.5"></script> <script src="https://cdn.jsdelivr.net/npm//dist/loadingoverlay.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/fancyapps//dist/jquery.fancybox.min.js"></script> <script src="https://cdn.socket.io/4.5.0/socket.io.min.js" integrity="sha384-7EyYLQZgWBi67fBtVxw60/OWl1kjsfrPFcaU0pp0nAh+i8FD068QogUvg85Ewy1k" crossorigin="anonymous"></script> <script> const socket = io(socketUrl); </script> </div></div></div></div></div></section></main></body> <script> // Start first run var listCompany = ""; var canShowQuote = "0" //html báo giá var htmlQuoteContact = `<div class="contact contact-element" id="request_quote">` + '<div class="pic quote"></div>' + '<div class="name">' + 'Yêu cầu báo giá' + `<div class="message" style="width:100%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;" title="${window.location.pathname.substring(1)}">${window.location.pathname.substring(1)}</div>` + '</div>' + '</div>' // kiểm tra trang hiện tại có lọc được doanh nghiệp nào hay không var hasCompany = 0; var hasContactRequestQuote = false let noImage = baseUrl + '/web/musk/common/images/noimages.png' // Nếu có báo giá thì remove // if (document.getElementById('request_quote')) { // localStorage.removeItem('roomId') // localStorage.removeItem('roomName') // hasContactRequestQuote = true // } showSpeech() function showSpeech () { $('#bubble-speech').hide() if (localStorage.getItem('clientToken')) { $('#bubble-speech').hide() } if (!localStorage.getItem('clientToken')) { setTimeout(() => { $('#bubble-speech').show() }, 1500) } } hideCloseButton() function hideCloseButton () { $('.close1').hide() $('.close2').hide() $('.close3').hide() $('.close4').hide() } $('.bubble-close').click((e) => { $('#bubble-speech').hide() }) $('.close').each((key, item) => { $(item).click((e) => { e.preventDefault() if ($(e.target)) { $(e.target).closest('.imageQuoteBtn').find('.imageQuote').attr('src', noImage) let eleName = $(e.target).closest('.imageQuoteBtn').find('.imageQuote').attr('name') if (eleName) { formDataQuote.delete(eleName) } } }) }) // kiểm tra có token và gọi ajax lấy danh sách contact if (localStorage.getItem('clientToken')) { $('#open_chat_box').show() $('#btn_open_chat_box').text('Lịch sử báo giá') getListContactForBoxChat() } if (!localStorage.getItem('clientToken')) { if (canShowQuote == 1) { if (filterScreen) { $('#open_chat_box').show() } setRoomNameGetQuote() $('#list-contact').append(htmlQuoteContact) showContentSendQuote() $('#request_quote').click(function () { showContentSendQuote() }) } else { $('#btn_open_chat_box').hide() let width = (window.innerWidth > 0) ? window.innerWidth : screen.width; if (width < 450) { $('.first-company-sponsor').css('left', '5px') } else { $('.first-company-sponsor').css('right', '5px') } } } // Ẩn ô chat $('#minimize_box_chat').click(function () { $('#musk_box_chat').hide() $('#open_chat_box').show() $('header').show() }) // Hiện ô chat $('#btn_open_chat_box').click(function () { $('#musk_box_chat').show() $('#open_chat_box').hide() var objDiv = document.getElementById("chat-content"); objDiv.scrollTop = objDiv.scrollHeight; if (hasContactRequestQuote) { showContentSendQuote() } if ($('#show_box_style').hasClass('fa-window-restore')) { $('header').hide() } }) function showContentSendQuote() { $('#request_quote_content').show() $('#chat-content').empty() $('#chat-content').hide() $('#box-room-name').text('Yêu cầu báo giá') $('#box-room-more-info').text(window.location.pathname.substring(1)) $('#box-room-image').attr('src', `${baseUrl}/web/img/quote-icon.png`) $('.contact-element').removeClass('active') $('#request_quote').addClass('active') $('#musk_box_chat .input').hide() } // Bấm gửi tin nhắn $('#submit-message').click(function () { submitSendMessage() }) // Gửi báo giá $('#submitSendQuote').click(function () { let data = $('#getQuote').attr('attr-list-id') let customerName = $('#customer-name').val() let customerPhoneNumber = $('#customer-phone-number').val() let message = $('#content-first-message').val() if(!customerName && !localStorage.getItem('clientToken') && !customerPhoneNumber) { alert('Vui lòng nhập tên, số điện thoại của bạn') return true } if (!message) { alert('Vui lòng nhập nội dung muốn báo giá!') return true } localStorage.setItem('fullName', customerName) if (data) { let listCompanyId = data.split(',') listCompanyId.forEach(item => { formDataQuote.append('listCompanyId[]', item) }) // listImage.forEach(item => { // formDataQuote.append('listImage[]', item) // }) formDataQuote.append('fullName', customerName) formDataQuote.append('clientToken', localStorage.getItem('clientToken') || '') formDataQuote.append('url', window.location.href) formDataQuote.append('listCompanyName', listCompany) formDataQuote.append('message', message) formDataQuote.append('phone', customerPhoneNumber) $.ajax({ url: baseUrl+'/customer/ajax_send_quote', method:'post', data: formDataQuote, beforeSend:function(){ $('#loadingGetQuote2').show() }, complete:function(){ $('#loadingGetQuote2').hide() }, success:function(data){ data = JSON.parse(data) if(data.code == 200){ localStorage.setItem('clientToken', data.data.token) showContentMess() getListContactForBoxChat() showSpeech() $('#imageQuoteName').text('') formDataQuote.delete('image1') formDataQuote.delete('image2') formDataQuote.delete('image3') formDataQuote.delete('image4') $('#imageQuote1').attr('src', noImage) $('#imageQuote2').attr('src', noImage) $('#imageQuote3').attr('src', noImage) $('#imageQuote4').attr('src', noImage) $('') $('#content-first-message').val('') } }, cache: false, contentType: false, processData: false }) } }) const MAX_WIDTH = 1366; const MAX_HEIGHT = 768; const MIME_TYPE = "image/jpeg"; const QUALITY = 0.7; $('#uploadImageUser').change(function (ev) { const file = ev.target.files[0]; // get the file var fileName = file.name.split('.')[0]; const blobURL = URL.createObjectURL(file); const img = new Image(); img.src = blobURL; img.onerror = function () { URL.revokeObjectURL(this.src); // Handle the failure properly console.log("Cannot load image"); }; let datatImageUrl = '' img.onload = function () { URL.revokeObjectURL(this.src); const [newWidth, newHeight] = calculateSize(img, MAX_WIDTH, MAX_HEIGHT) const canvas = document.createElement("canvas"); canvas.width = newWidth; canvas.height = newHeight; const ctx = canvas.getContext("2d"); ctx.drawImage(img, 0, 0, newWidth, newHeight); canvas.toBlob( (blob) => { // Handle the compressed image. es. upload or save in local state let formData = new FormData() formData.append('image', new File([blob], fileName + ".jpeg")) formData.append('roomId', localStorage.getItem('roomId')) formData.append('token', localStorage.getItem('clientToken')) $.ajax({ url: baseUrl+'/customer/ajax_send_message_image', type: "POST", data: formData, success: function (msg) { let el = $('.contact.contact-element.active') if(el) { selectRoomChat(el.attr('attr-room-id'), el.attr('attr-room-name'), el.attr('attr-room-image'), el.attr('attr-room-more-info'), el.attr('attr-room-confirmed')) socket.emit('clientSocket', localStorage.getItem('roomId'), el.attr('attr-room-confirmed')) } getDataActiveDotCustomer() }, cache: false, contentType: false, processData: false }); }, MIME_TYPE, QUALITY ); }; }) let formDataQuote = new FormData() let listImage = [] $('.uploadImageQuote1').change(function (ev) { const file = ev.target.files[0]; // get the file var fileName = file.name.split('.')[0]; const blobURL = URL.createObjectURL(file); const img = new Image(); img.src = blobURL; img.onerror = function () { URL.revokeObjectURL(this.src); // Handle the failure properly console.log("Cannot load image"); }; $('#imageQuote1').attr("src",blobURL) img.onload = function () { URL.revokeObjectURL(this.src); const [newWidth, newHeight] = calculateSize(img, MAX_WIDTH, MAX_HEIGHT) const canvas = document.createElement("canvas"); canvas.width = newWidth; canvas.height = newHeight; const ctx = canvas.getContext("2d"); ctx.drawImage(img, 0, 0, newWidth, newHeight); canvas.toBlob( (blob) => { //listImage[0] = new File([blob], fileName + ".jpeg") formDataQuote.append('image1', new File([blob], fileName + ".jpeg")) $('.close1').show() }, MIME_TYPE, QUALITY ); }; }) $('.uploadImageQuote2').change(function (ev) { const file = ev.target.files[0]; // get the file var fileName = file.name.split('.')[0]; const blobURL = URL.createObjectURL(file); const img = new Image(); img.src = blobURL; img.onerror = function () { URL.revokeObjectURL(this.src); // Handle the failure properly console.log("Cannot load image"); }; $('#imageQuote2').attr("src",blobURL) img.onload = function () { URL.revokeObjectURL(this.src); const [newWidth, newHeight] = calculateSize(img, MAX_WIDTH, MAX_HEIGHT) const canvas = document.createElement("canvas"); canvas.width = newWidth; canvas.height = newHeight; const ctx = canvas.getContext("2d"); ctx.drawImage(img, 0, 0, newWidth, newHeight); canvas.toBlob( (blob) => { //listImage[1] = new File([blob], fileName + ".jpeg") formDataQuote.append('image2', new File([blob], fileName + ".jpeg")) $('.close2').show() }, MIME_TYPE, QUALITY ); }; }) $('.uploadImageQuote3').change(function (ev) { const file = ev.target.files[0]; // get the file var fileName = file.name.split('.')[0]; const blobURL = URL.createObjectURL(file); const img = new Image(); img.src = blobURL; img.onerror = function () { URL.revokeObjectURL(this.src); // Handle the failure properly console.log("Cannot load image"); }; $('#imageQuote3').attr("src",blobURL) img.onload = function () { URL.revokeObjectURL(this.src); const [newWidth, newHeight] = calculateSize(img, MAX_WIDTH, MAX_HEIGHT) const canvas = document.createElement("canvas"); canvas.width = newWidth; canvas.height = newHeight; const ctx = canvas.getContext("2d"); ctx.drawImage(img, 0, 0, newWidth, newHeight); canvas.toBlob( (blob) => { //listImage[2] = new File([blob], fileName + ".jpeg") formDataQuote.append('image3', new File([blob], fileName + ".jpeg")) $('.close3').show() }, MIME_TYPE, QUALITY ); }; }) $('.uploadImageQuote4').change(function (ev) { const file = ev.target.files[0]; // get the file var fileName = file.name.split('.')[0]; const blobURL = URL.createObjectURL(file); const img = new Image(); img.src = blobURL; img.onerror = function () { URL.revokeObjectURL(this.src); // Handle the failure properly console.log("Cannot load image"); }; $('#imageQuote4').attr("src",blobURL) img.onload = function () { URL.revokeObjectURL(this.src); const [newWidth, newHeight] = calculateSize(img, MAX_WIDTH, MAX_HEIGHT) const canvas = document.createElement("canvas"); canvas.width = newWidth; canvas.height = newHeight; const ctx = canvas.getContext("2d"); ctx.drawImage(img, 0, 0, newWidth, newHeight); canvas.toBlob( (blob) => { //listImage[3] = new File([blob], fileName + ".jpeg") formDataQuote.append('image4', new File([blob], fileName + ".jpeg")) $('.close4').show() }, MIME_TYPE, QUALITY ); }; }) function calculateSize(img, maxWidth, maxHeight) { let width = img.width; let height = img.height; // calculate the width and height, constraining the proportions if (width > height) { if (width > maxWidth) { height = Math.round((height * maxWidth) / width); width = maxWidth; } } else { if (height > maxHeight) { width = Math.round((width * maxHeight) / height); height = maxHeight; } } return [width, height]; } // Utility functions for demo purpose function readableBytes(bytes) { const i = Math.floor(Math.log(bytes) / Math.log(1024)), sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; return (bytes / Math.pow(1024, i)).toFixed(2) + ' ' + sizes[i]; } handleModeScreenChat() function handleModeScreenChat() { $('#show_box_style').click(function () { if ($(this).hasClass('fa-window-maximize')) { $(this).removeClass('fa-window-maximize') $(this).addClass('fa-window-restore') $('#content-contact-id').css('height', '100vh') $('#content-chat-id').css('height', '100vh') $('header').hide() } else { $(this).removeClass('fa-window-restore') $(this).addClass('fa-window-maximize') $('#content-contact-id').css('height', '60vh') $('#content-chat-id').css('height', '60vh') $('header').show() } }) } // button mở box chat function showButtonOpenChatBox() { $('#open_chat_box').show() } function hideButtonOpenChatBox() { $('#open_chat_box').hide() } // button yêu cầu báo giá function showButtonGetQuote() { $('#getQuote').show() } function hideButtonGetQuote() { $('#getQuote').hide() } // ẩn hiện list contact function showListContact() { $('.contacts').show() } // ẩn hiện input nhập tin nhắn function hideInputMessage() { $('#input-message').hide() } function showInputMessage() { $('#input-message').show() } // hiển thị nội dung báo giá - khi đã có token function showContentQuote () { if (localStorage.getItem('clientToken')) { $('#customer-name').hide() $('#customer-phone-number').hide() } $('#request_quote').show() $('#request_quote_content').show() $('#chat-content').hide() $('#musk_box_chat .input').hide() setTitleButtonGetQuote() } // hiển thị nội dung message - khi đã có token function showContentMess () { $('#request_quote_content').hide() $('#chat-content').show() $('#musk_box_chat .input').show() } function showContentQuoteWithoutToken () { $('.contacts').hide() $('#musk_box_chat .input').hide() $('#musk_box_chat').show() } function setRoomNameGetQuote() { $('#box-room-name').text('Yêu cầu báo giá') } function setTitleButtonGetQuote() { // $('#btn_open_chat_box').text('Yêu cầu báo giá') } function setActiveContactSendQuote() { $('.contact-element').removeClass('active') $('#request_quote').addClass('active') } // Khi chọn user báo giá $('#getQuote').click(function () { showContentQuoteWithoutToken() }) // Bấm enter để gửi tin nhắn var el = document.getElementById("input-message"); if (el) { el.addEventListener("keydown", function(event) { if (event.key === "Enter") { submitSendMessage() } }); } // lấy danh sách contact function getListContactForBoxChat() { $.ajax({ url: baseUrl+'/customer/get_list_contact', method:'post', dataType:'json', data: { clientToken: localStorage.getItem('clientToken') || '' }, beforeSend:function(){ }, complete:function(){ }, success:function(data){ if(data.code == 200){ let html = '' let checkSelectRoom = false data.data.listContact.forEach((value, index) => { html += `<div class="contact contact-element ${index === 0 && (!hasContactRequestQuote || canShowQuote == 1)? 'active' : ''}" attr-room-id="${value.roomId}" attr-room-confirmed=${value.isConfirmed} attr-room-name="${value.roomName}" attr-room-image="${baseUrl}${value.image ? '/uploads/files/' + value.image :'/web/img/user_icon.png'}" attr-room-more-info="SĐT: ${value.phoneNumber} - ĐC: ${value.address}" attr-partner-id=${value.partnerId}> <div class="pic"> <img style="object-fit:cover; width:40px;height:40px;border-radius:5px" onerror="this.onerror=null;this.src='${baseUrl}/web/img/company_icon.png'" src="${baseUrl}${value.image ? '/uploads/files/' + value.image :'/web/img/user_icon.png'}" /></div> <div class="name" title="${value.roomName}">${value.roomName}</div> <div class="message" style="width:100%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;" title="SĐT: ${value.phoneNumber} - ĐC: ${value.address}">SĐT: ${value.phoneNumber} - ĐC: ${value.address}</div> <span class="badge rounded-pill float-end active-dot" style="color:#2fab51;border:none;padding:0px;background-color:unset;display:none"><i class="fa fa-circle" aria-hidden="true"></i></span> <span class="badge rounded-pill float-end active-mess" style="border:none;padding:4px;background-color:orange;left:33px;margin-top:20px;${value.isNewMess ? '':'display:none'}">1+</span> </div>` }) if (!checkSelectRoom && hasContactRequestQuote) { setActiveContactSendQuote() } $('#list-contact').empty() // let checkHasNewUrl = false // if (typeof filterScreen !== 'undefined' && filterScreen && !checkUrl) { // if (hasCompany) { // $('#list-contact').append(htmlQuoteContact) // checkHasNewUrl = true // // $('#request_quote').click(function () { // showContentSendQuote() // }) // } // } if(canShowQuote == 1) { $('#list-contact').append(htmlQuoteContact) } else { $('#request_quote_content').hide() } $('#request_quote').click(function () { showContentSendQuote() }) $('#list-contact').append(html) // if (checkHasNewUrl) { // showContentQuote() // setRoomNameGetQuote() // setActiveContactSendQuote() // } // Chọn room $('.contact-element').click(function () { $('.contact-element').removeClass('active') $(this).addClass('active') if ($(this).attr('attr-room-id')) { selectRoomChat($(this).attr('attr-room-id'), $(this).attr('attr-room-name'), $(this).attr('attr-room-image'), $(this).attr('attr-room-more-info'), $(this).attr('attr-room-confirmed')) } else { setRoomNameGetQuote() } }) let htmlHistoryQuote = '' let checkUrl = false function showHistoryMessage (message) { if (message.includes('[IMAGE]') || message.includes('[IMAGE_GROUP]')) { return message.replace(/\[IMAGE.*/, '<br/> [Hình ảnh đính kèm]') } return message } data.data.listQuote.forEach((quote, index) => { // if(window.location.href == quote.url) { // checkUrl = true // } if (quote.status == 0) { htmlHistoryQuote += '<hr>' + `<div><b>Yêu cầu: </b> ${quote.url}</div><div><b>Trạng thái:</b> <b style="color:${getStatusQuoteColor(quote.status)}">${getStatusQuote(quote.status)}</b></div><p class="quote-history-list-company">` + '<span class="btn-view-company text-decoration-underline" style="cursor:pointer;color:#0275d8" title="'+quote.listCompanyName+'">Bấm xem danh sách công ty</span><span style="display:none" class="data-company">' + quote.listCompanyName + '<div>' + '<b>Lời nhắn của bạn: </b>' + showHistoryMessage(quote.message)+ '</div>' } }) $('#request_quote_history').html(htmlHistoryQuote) $('.btn-view-company').click(function () { $(this).hide() $(this).parents().find('.data-company').show() }) if (typeof filterScreen !== 'undefined' && filterScreen && checkUrl) { $('#input-data-request-quote').hide() $('#request_quote_current_url').hide() } else { $('#customer-name').hide() $('#customer-phone-number').hide() } if(canShowQuote == 1) { showContentSendQuote() } else { if (!$('.contact-element.active')) { $('.contact.contact-element').first().addClass('active') } let el = $('.contact.contact-element.active') if(el) { selectRoomChat(el.attr('attr-room-id'), el.attr('attr-room-name'), el.attr('attr-room-image'), el.attr('attr-room-more-info'), el.attr('attr-room-confirmed')) socket.emit('clientSocket', localStorage.getItem('roomId'), el.attr('attr-room-confirmed')) } } if (data.data.clientId) { socket.emit('clientConnection', data.data.clientId) } } else if (data.code == 401){ localStorage.clear() } } }) } function getStatusQuote(status) { let result = 'Đang chờ duyệt'; if (status == 1) { result = 'Đã duyệt' } return result } function getStatusQuoteColor(status) { let result = '#0275d8'; if (status == 1) { result = '#5cb85c' } return result } // Gửi tin nhắn function submitSendMessage() { if ($('#input-message-data').hasClass('active')) { return true } if (!localStorage.getItem('roomId')) { alert('Vui lòng chọn công ty bạn muốn gửi tin') } if ($('#input-message').val()) { $.ajax({ url: baseUrl+'/customer/ajax_send_message', method:'post', dataType:'json', data: { clientToken: localStorage.getItem('clientToken') || '', roomId: localStorage.getItem('roomId') || '', content: $('#input-message').val() }, beforeSend:function(){ $('#input-message-data').addClass('active') $('#input-message-data').css('pointer-events', 'none') $('#loading-send-message').show() $('#submit-message').hide() }, complete:function(){ $('#input-message-data').removeClass('active') $('#input-message-data').css('pointer-events', 'unset') $('#loading-send-message').hide() $('#submit-message').show() }, success:function(data){ if(data.code == 200){ $('#input-message').val('') var objDiv = document.getElementById("chat-content"); objDiv.scrollTop = objDiv.scrollHeight; getMessageWithAjax() socket.emit('clientSocket', localStorage.getItem('roomId')) getDataActiveDotCustomer() } } }) } } // Chọn phòng chat function selectRoomChat(roomId, roomName, roomImage, roomMoreInfo, isConfirmed) { $('#box-room-name').text(roomName) $('#box-room-name').attr('title',roomName) $('#box-room-image').attr('src', roomImage) $('#box-room-more-info').text(roomMoreInfo) $('#box-room-more-info').attr('title',roomMoreInfo) localStorage.setItem('roomId', roomId) showContentMess() getMessageWithAjax() if (isConfirmed == 0 || isConfirmed == null || isConfirmed == 'null') { $('#musk_box_chat .input').hide() } else { $('#musk_box_chat .input').show() } } function getMessageWithAjax() { $.ajax({ url: baseUrl+'/customer/ajax_get_message', method:'post', dataType:'json', data: { clientToken: localStorage.getItem('clientToken') || '', roomId: localStorage.getItem('roomId') || '' }, beforeSend:function(){ }, complete:function(){ }, success:function(data){ if(data.code == 200) { let html = '' data.data.forEach((value, index) => { if (value.type == 1) { html += `<div class="message mess-system"><div>${getContentMess(value.content)}</div></div>` } else { html += `<div class="message ${value.mine == 1 ? 'parker' : 'stark'} ${value.type == 1 ? 'mess-system' : ''}" title="${value.name}"><div style="font-size:10px;line-height:12px;"><i class="fa ${value.isCustomer == 1 ? 'fa-user' : 'fa-building'}" aria-hidden="true"></i> ${value.name}</div><div style="word-break:break-all;overflow:hidden">${getContentMess(value.content)}</div><span style="font-size:10px">${changeFormat(value.createdAt)}</span></div>` } }) $('#chat-content').empty() $('#chat-content').append(html) var objDiv = document.getElementById("chat-content"); objDiv.scrollTop = objDiv.scrollHeight; } else if (data.code == 401) { localStorage.clear() } } }) } function getContentMess(content) { if (content && content.includes('type:image=')) { content = content.replace('type:image=', '') return `<img class="messengerImage" style="max-width:300px;cursor:pointer" src="${baseUrl}/uploads/message_image/${content}">` } if (content && content.includes('[IMAGE_GROUP]')) { let listData = content.split('[IMAGE_GROUP]') if (listData) { let contentMess = '<div class="row p-2" style="background-color:#f5f6f7!important;width:190px;">' contentMess += '<div class="col-12 text-dark">'+listData[0]+'</div>' listData.forEach((item, key) => { if(key != 0) { if (item.includes('|')) { let listImage = item.split('|') if (listImage) { listImage.forEach((item2, key2) => { contentMess += '<div class="col-xs-12 col-md-6 col-lg-6 p-2"><img class="messengerImage" style="width:100%;height:auto;cursor:pointer" src="'+baseUrl+'/uploads/message_image/'+item2+'"></div>' }) } } else { contentMess += '<div class="col-xs-12 col-md-6 col-lg-6 p-2"><img class="messengerImage" style="width:100%;height:auto;cursor:pointer" src="'+baseUrl+'/uploads/message_image/'+item+'"></div>' } } }) contentMess += '</div>' return contentMess } } return content } // Gọi socket function callSocket() { $.ajax({ url: baseUrl+'/customer/call_socket', method:'get', dataType:'json', }) } function getDataActiveDotCustomer() { $.ajax({ url: baseUrl+'/customer/get_data_active_dot', method:'post', dataType:'json', data: { clientToken: localStorage.getItem('clientToken') || '' }, beforeSend:function(){ }, complete:function(){ }, success:function(data){ if(data.code == 200) { $(`.contact-element .active-mess`).hide() data.data.listContact.forEach(x => { if (x.isNewMess == 1) { $(`.contact-element[attr-room-id=${x.roomId}] .active-mess`).show() } }) } else if (data.code == 401) { localStorage.clear() } } }) } socket.on('loadClient', (Id) => { getMessageWithAjax() getDataActiveDotCustomer() }) socket.on('loadChatBox', () => { getListContactForBoxChat() showSpeech() FeedBack.checkShowFeedback() }) socket.on('loadUserActive', (listClientId) => { $(`.contact-element .active-dot`).hide() if (listClientId) { let data = Object.values(listClientId) data.forEach(x => { $(`[attr-partner-id=${x}] .active-dot`).show() }) } }) function changeFormat(val) { let dataDate = val.split(' ') if (dataDate.length === 2) { let dataTime = dataDate[1] let d = new Date(val.replace(/\s/, 'T')) let date = d.getDate() let month = d.getMonth() + 1 let year = d.getFullYear() return dataTime + ' ' + date.toString().padStart(2, '0') + "/" + month.toString().padStart(2, '0') + "/" + year } return '' } </script> </html>