Spaces:
IrDelSol
/
Runtime error

DmitrMakeev commited on
Commit
3bf49ce
·
verified ·
1 Parent(s): 385fbe6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -0
app.py CHANGED
@@ -1892,6 +1892,51 @@ def add_data_gc_in():
1892
 
1893
 
1894
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1895
 
1896
 
1897
 
 
1892
 
1893
 
1894
 
1895
+ @app.route('/biz_365_help_1.js')
1896
+ def biz_365_bridge():
1897
+ script_content = """
1898
+ document.getElementById('supportButton').addEventListener('click', function() {
1899
+ Swal.fire({
1900
+ title: 'Вопрос через WhatsApp',
1901
+ html: `
1902
+ <textarea id="supportInput" class="swal2-textarea" placeholder="Введите ваш вопрос"></textarea>
1903
+ `,
1904
+ showClass: {
1905
+ popup: 'animate__animated animate__fadeInUp animate__faster'
1906
+ },
1907
+ hideClass: {
1908
+ popup: 'animate__animated animate__fadeOutDown animate__faster'
1909
+ },
1910
+ confirmButtonText: 'Отправить',
1911
+ confirmButtonColor: '#079100',
1912
+ cancelButtonText: 'Закрыть',
1913
+ cancelButtonColor: '#ff0000',
1914
+ showCancelButton: true,
1915
+ showCloseButton: false,
1916
+ customClass: {
1917
+ confirmButton: 'swal2-confirm',
1918
+ cancelButton: 'swal2-cancel',
1919
+ textarea: 'swal2-textarea',
1920
+ popup: 'swal2-popup'
1921
+ },
1922
+ preConfirm: () => {
1923
+ const question = Swal.getPopup().querySelector('#supportInput').value;
1924
+ if (!question) {
1925
+ Swal.showValidationMessage('Пожалуйста, введите ваш вопрос');
1926
+ }
1927
+ return { question: question };
1928
+ }
1929
+ }).then((result) => {
1930
+ if (result.isConfirmed) {
1931
+ const question = result.value.question;
1932
+ const encodedQuestion = encodeURIComponent(question);
1933
+ const whatsappUrl = `https://api.whatsapp.com/send?phone=${encodedPhone}&text=${encodedQuestion}`;
1934
+ window.open(whatsappUrl, '_blank');
1935
+ }
1936
+ });
1937
+ });
1938
+ """
1939
+ return Response(script_content, mimetype='application/javascript')
1940
 
1941
 
1942