Доработал ридми. Добавил каталоги настроек сервиса на внутреннем веб сервере и каталог с файлами виджета.
This commit is contained in:
		
							parent
							
								
									adb845c42d
								
							
						
					
					
						commit
						325aee9d5b
					
				| 
						 | 
					@ -0,0 +1,23 @@
 | 
				
			||||||
 | 
					##То что нужно добавить в ваш конфиг Apache чтоб опубликовать базу 1С.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# StatusForm publication
 | 
				
			||||||
 | 
					#Alias "/statusform" "/var/www/statusform/"
 | 
				
			||||||
 | 
					<Directory "/var/www/html/statusform/">
 | 
				
			||||||
 | 
					    AllowOverride AuthConfig FileInfo Limit
 | 
				
			||||||
 | 
					</Directory>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# 1c publication
 | 
				
			||||||
 | 
					Alias "/emp" "/var/www/emp/"
 | 
				
			||||||
 | 
					<Directory "/var/www/emp/">
 | 
				
			||||||
 | 
					    AllowOverride All
 | 
				
			||||||
 | 
					    Options None
 | 
				
			||||||
 | 
					    Require all granted
 | 
				
			||||||
 | 
					    SetHandler 1c-application
 | 
				
			||||||
 | 
					    ManagedApplicationDescriptor "/var/www/emp/default.vrd"
 | 
				
			||||||
 | 
					</Directory>
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# !ОБЯЗАТЕЛЬНО! прописываем в строке ниже путь к установленной библиотеке 1С
 | 
				
			||||||
 | 
					# Релиз установленного 1С в Apache должен совпадать с релизом платформы установленной на сервере 1С
 | 
				
			||||||
 | 
					LoadModule _1cws_module "/opt/1cv8/x86_64/8.3.20.1996/wsap24.so"
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,20 @@
 | 
				
			||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
 | 
					<point xmlns="http://v8.1c.ru/8.2/virtual-resource-system"
 | 
				
			||||||
 | 
							xmlns:xs="http://www.w3.org/2001/XMLSchema"
 | 
				
			||||||
 | 
							xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 | 
				
			||||||
 | 
							base="/emp"
 | 
				
			||||||
 | 
							ib="Srvr=YourServer1C;Ref=NameBase1C;usr=UserForService;pwd=SecretPassword" enable="false">
 | 
				
			||||||
 | 
							<debug enable="true"
 | 
				
			||||||
 | 
							url="YourServer1C"/>
 | 
				
			||||||
 | 
						<standardOdata enable="false"
 | 
				
			||||||
 | 
								reuseSessions="autouse"
 | 
				
			||||||
 | 
								sessionMaxAge="20"
 | 
				
			||||||
 | 
								poolSize="10"
 | 
				
			||||||
 | 
								poolTimeout="5"/>
 | 
				
			||||||
 | 
						<analytics enable="true"/>
 | 
				
			||||||
 | 
						<httpServices>
 | 
				
			||||||
 | 
							<service name="HS_CSM_API"
 | 
				
			||||||
 | 
							rootUrl="CSM-API"
 | 
				
			||||||
 | 
							enable="true"/>
 | 
				
			||||||
 | 
						</httpServices>
 | 
				
			||||||
 | 
					</point>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,31 @@
 | 
				
			||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$post = file_get_contents('php://input');
 | 
				
			||||||
 | 
					//echo $post; // прилетает строкаю json сразу
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					// Если надо разбить по параметрам
 | 
				
			||||||
 | 
					$params = json_decode($post,true);
 | 
				
			||||||
 | 
					echo $params['urfiz'].' | '.$params['INN'].' | '.$params['strNumDoc'];
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$url = 'http://name.or.ip.adrees.your.web.server/statusDoc';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$result = file_get_contents($url, false, stream_context_create(array(
 | 
				
			||||||
 | 
					    'http' => array(
 | 
				
			||||||
 | 
					    'method'  => 'POST',
 | 
				
			||||||
 | 
					    'header'  => 'Content-type: application/json', //'Content-type: application/x-www-form-urlencoded',
 | 
				
			||||||
 | 
					    'content' => $post//json_encode($post) //http_build_query($params)
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// $arr = json_decode($result);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// тестовый ответ
 | 
				
			||||||
 | 
					//sleep(5); // имитация ожидания ответа от сервака 5 sec
 | 
				
			||||||
 | 
					//$str='[{"Контрагент":"Общество с ограниченной ответственностью \"Фотон сервис\"","Заявка":"Заказ 00НОЕМ-000035 от 10.02.2021 16:24:35","СтатусЗаявки":"Зарегистрировано","Счет":"Счет покупателю 00000000711 от 10.02.2021 16:31:20","НаличиеОплаты":"Оплаты нет","СуммаОплаты":0},	{"Контрагент":"Общество с ограниченной ответственностью \"Фотон сервис\"","Заявка":"Заказ 00НОЕМ-000043 от 12.02.2021 11:32:58","СтатусЗаявки":"Зарегистрировано","Счет":"Счет покупателю 00000000793 от 12.02.2021 11:33:21","НаличиеОплаты":"Оплаты нет","СуммаОплаты":0},	{"Контрагент":"Общество с ограниченной ответственностью \"Фотон сервис\"","Заявка":"Заказ НРО-ЗАК-00072 от 24.03.2021 15:09:49","СтатусЗаявки":"Выполняется","Счет":"Счет покупателю НРО-СЧ-0065 от 24.03.2021 15:10:18","НаличиеОплаты":"Оплата есть","СуммаОплаты":12166.2},	{"Контрагент":"Общество с ограниченной ответственностью \"Фотон сервис\"","Заявка":"Заказ НРО-ЗАК-00276 от 23.06.2021 11:19:58","СтатусЗаявки":"Выполняется","Счет":"Счет покупателю НРО-СЧ-0312 от 07.07.2021 14:17:04","НаличиеОплаты":"Оплата есть","СуммаОплаты":89602.2}]';
 | 
				
			||||||
 | 
					//echo $str;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo $result;
 | 
				
			||||||
 | 
					?>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,164 @@
 | 
				
			||||||
 | 
					<!DOCTYPE html>
 | 
				
			||||||
 | 
					<html lang="ru">
 | 
				
			||||||
 | 
					<head>
 | 
				
			||||||
 | 
					    <meta charset="UTF-8">
 | 
				
			||||||
 | 
					    <meta http-equiv="X-UA-Compatible" content="IE=edge">
 | 
				
			||||||
 | 
					    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
				
			||||||
 | 
					    <title>ФБУ "Якутский ЦСМ"| Проверка статуса Заявки клиента</title>
 | 
				
			||||||
 | 
					    <link rel='stylesheet' href='style.css' />
 | 
				
			||||||
 | 
					   
 | 
				
			||||||
 | 
					    <!--
 | 
				
			||||||
 | 
					   <style>
 | 
				
			||||||
 | 
					      red{color: red;}
 | 
				
			||||||
 | 
					      divcenter {
 | 
				
			||||||
 | 
					          width: 680px;
 | 
				
			||||||
 | 
					          display: block;
 | 
				
			||||||
 | 
					          top: 20%;
 | 
				
			||||||
 | 
					          left: 25%;
 | 
				
			||||||
 | 
					          position: absolute;
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					      ErrorMessage{
 | 
				
			||||||
 | 
					         color: red;  
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      div.new_form {
 | 
				
			||||||
 | 
					          width: 600px;
 | 
				
			||||||
 | 
					          border: 1px solid red;
 | 
				
			||||||
 | 
					          display: block;
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      div.new_form input[type="text"] {
 | 
				
			||||||
 | 
					          width: 100%;
 | 
				
			||||||
 | 
					          margin-top: 10px;
 | 
				
			||||||
 | 
					          padding: 10px 0;
 | 
				
			||||||
 | 
					          text-indent: 15px;
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       div.new_form input[type="number"] {
 | 
				
			||||||
 | 
					          width: 100%;
 | 
				
			||||||
 | 
					          margin-top: 10px;
 | 
				
			||||||
 | 
					          padding: 10px 0;
 | 
				
			||||||
 | 
					          text-indent: 15px;
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       div.new_form input[type="radio"] {
 | 
				
			||||||
 | 
					          width: 15px;
 | 
				
			||||||
 | 
					          padding: 10px 0;
 | 
				
			||||||
 | 
					          text-indent: 1px;
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					       div.new_form input[type="submit"] {
 | 
				
			||||||
 | 
					          float: right;
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       div.new_form input {
 | 
				
			||||||
 | 
					          width: 49%;
 | 
				
			||||||
 | 
					          margin-top: 10px;
 | 
				
			||||||
 | 
					          padding: 10px 0;
 | 
				
			||||||
 | 
					          text-indent: 15px;
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       div.new_form {
 | 
				
			||||||
 | 
					          width: 600px;
 | 
				
			||||||
 | 
					          border: 1px solid #cecece;
 | 
				
			||||||
 | 
					          display: block;
 | 
				
			||||||
 | 
					          height: 210px;
 | 
				
			||||||
 | 
					          padding: 40px;     box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 3px 6px rgba(0,0,0,0.22);     margin: auto;
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					       h2.forms {
 | 
				
			||||||
 | 
					          text-align: center;
 | 
				
			||||||
 | 
					          font-family: sans-serif;
 | 
				
			||||||
 | 
					          font-weight: 100;
 | 
				
			||||||
 | 
					          color: #4d5d53;
 | 
				
			||||||
 | 
					          text-transform: uppercase;
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       /* начало раскраски кнопок RADIO */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       .form_radio_btn {
 | 
				
			||||||
 | 
					      	display: inline-block;
 | 
				
			||||||
 | 
					      	/* margin-right: 10px; */
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       .form_radio_btn input[type=radio] {
 | 
				
			||||||
 | 
					      	display: none;
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       .form_radio_btn label {
 | 
				
			||||||
 | 
					         width: 266px;
 | 
				
			||||||
 | 
					      	display: inline-block;
 | 
				
			||||||
 | 
					      	cursor: pointer;
 | 
				
			||||||
 | 
					      	padding: 0px 15px;
 | 
				
			||||||
 | 
					      	line-height: 35px;
 | 
				
			||||||
 | 
					      	border: 1px solid #999;
 | 
				
			||||||
 | 
					      	border-radius: 6px;
 | 
				
			||||||
 | 
					      	user-select: none;
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					       /* Checked */
 | 
				
			||||||
 | 
					       .form_radio_btn input[type=radio]:checked + label {
 | 
				
			||||||
 | 
					      	background: #ffe0a6;
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					       /* Hover */
 | 
				
			||||||
 | 
					       .form_radio_btn label:hover {
 | 
				
			||||||
 | 
					      	color: #666;
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					       /* Disabled */
 | 
				
			||||||
 | 
					       .form_radio_btn input[type=radio]:disabled + label {
 | 
				
			||||||
 | 
					      	background: #efefef;
 | 
				
			||||||
 | 
					      	color: #666;
 | 
				
			||||||
 | 
					       } 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       /* конец раскраски кнопок RADIO */
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					       rezult {
 | 
				
			||||||
 | 
					          display: block;
 | 
				
			||||||
 | 
					          margin: 14px;
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					       
 | 
				
			||||||
 | 
					       #result_table {
 | 
				
			||||||
 | 
						        position:relative;
 | 
				
			||||||
 | 
								margin-top:100px;
 | 
				
			||||||
 | 
								top:0;
 | 
				
			||||||
 | 
								width: 680px;
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    </style> -->
 | 
				
			||||||
 | 
					    <script src="script.js"></script>
 | 
				
			||||||
 | 
					</head>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<body>
 | 
				
			||||||
 | 
					    <divcenter>
 | 
				
			||||||
 | 
					    <h2 class="forms">Проверка статуса готовности</br> по номеру Заявки / Счета</h2>
 | 
				
			||||||
 | 
					    <div id="ErrorMessage" class="ErrorMessage"></div>
 | 
				
			||||||
 | 
					    <!-- <rezult><? echo $info;?></rezult> -->
 | 
				
			||||||
 | 
					        <div class="new_form">     
 | 
				
			||||||
 | 
					            <div class="form_radio_btn">
 | 
				
			||||||
 | 
						            <input type="radio" name="urfiz" id="ur" value="ur" checked oninput="btnClick();">
 | 
				
			||||||
 | 
						            <label for="ur">Юридическое лицо</label>
 | 
				
			||||||
 | 
						            <input type="radio" name="urfiz" id="fiz" value="fiz" oninput="btnClick();">
 | 
				
			||||||
 | 
						            <label for="fiz">Физическое лицо</label>
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            <input type="text" name="INN" id="INN" placeholder="ИНН юр.лица" oninput="checkRegExpValNumber();">
 | 
				
			||||||
 | 
					            <input type="text" name="strNumDoc" id="strNumDoc" placeholder="Номера документов через запятую" oninput="checkRegExpValRusNum()">
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					            <input type="submit" id="submit_btn" value="Получить данные" onclick="return send_data();">
 | 
				
			||||||
 | 
					            <div id="bottom_text">
 | 
				
			||||||
 | 
					               <p>
 | 
				
			||||||
 | 
					               Порядок действий: <br>
 | 
				
			||||||
 | 
					               1. Выбрать представление Контрагента - Юр.лицо / Физ.лицо <br>
 | 
				
			||||||
 | 
					               2. (Опционально) Для Юр.лица указать ИНН <br>
 | 
				
			||||||
 | 
					               3. Внести список номеров документов, разделенных запятой <br>
 | 
				
			||||||
 | 
					               ... Пример: ТТ-ЗАК-00123,ЭЛР-СЧ-01234 и т.д. Желательно, не более 5 номеров <br>
 | 
				
			||||||
 | 
					               4. Нажать кнопку "Получить данные"</p>
 | 
				
			||||||
 | 
					            </div>   
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					    <div id="result_table"></div>
 | 
				
			||||||
 | 
					    </divcenter>
 | 
				
			||||||
 | 
					</body>
 | 
				
			||||||
 | 
					</html>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,181 @@
 | 
				
			||||||
 | 
					function btnClick()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					            var errorText = "";
 | 
				
			||||||
 | 
					            var INNVal = "";
 | 
				
			||||||
 | 
					            var urfiz = "";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //urfiz = GetValChackedRadioButton('urfiz');
 | 
				
			||||||
 | 
					            urfiz = document.querySelector('input[name="urfiz"]:checked').value;
 | 
				
			||||||
 | 
					            INNVal = document.getElementById('INN').value;
 | 
				
			||||||
 | 
					            errorText = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (urfiz == "fiz" & INNVal.length != 0){
 | 
				
			||||||
 | 
					                errorText = 'Для физ.лиц задавать ИНН не нужно.';
 | 
				
			||||||
 | 
					                document.getElementById('INN').value = "";
 | 
				
			||||||
 | 
					                INNVal = document.getElementById('INN').value;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (urfiz == "fiz" & INNVal.length == 0){
 | 
				
			||||||
 | 
					                document.getElementById('INN').hidden = true;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (urfiz == "ur" & INNVal.length == 0){
 | 
				
			||||||
 | 
					                document.getElementById('INN').hidden = false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					            if (errorText != ""){
 | 
				
			||||||
 | 
					                    document.getElementById('ErrorMessage').hidden = false;
 | 
				
			||||||
 | 
					                    document.getElementById('ErrorMessage').innerHTML="<HR color='red'>"+
 | 
				
			||||||
 | 
					                    "ВНИМАНИЕ: " + errorText.bold() + "<HR color='red'>";
 | 
				
			||||||
 | 
					                }else{
 | 
				
			||||||
 | 
					                    document.getElementById('ErrorMessage').hidden = true;    
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            //alert(document.querySelector("#INN").value);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function checkRegExpValNumber(){
 | 
				
			||||||
 | 
					    //тут проверяем, а не входит ли случайно введеный символ в инн,
 | 
				
			||||||
 | 
					    // в список НЕ цифр. Если символ не цифра, то ругаемся и удаляем символ.
 | 
				
			||||||
 | 
					    const inn = document.querySelector('input[name="INN"]');
 | 
				
			||||||
 | 
					    inn.addEventListener('input', updateValueInn);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function updateValueInn(letter){
 | 
				
			||||||
 | 
					    var reg = /^\d{10}$/;
 | 
				
			||||||
 | 
					    var bukva = letter.target.value; //получаем измененную строку
 | 
				
			||||||
 | 
					    var validNum = reg.test(bukva);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!validNum) {
 | 
				
			||||||
 | 
					        var errorText = "ИНН должен состоять ТОЛЬКО из цифр и составлять 10 знаков";
 | 
				
			||||||
 | 
					        document.getElementById('ErrorMessage').hidden = false;
 | 
				
			||||||
 | 
					        document.getElementById('ErrorMessage').innerHTML="<HR color='red'>"+
 | 
				
			||||||
 | 
					        "ВНИМАНИЕ: " + errorText.bold() + "<HR color='red'>";
 | 
				
			||||||
 | 
					    }else{
 | 
				
			||||||
 | 
					        var errorText = "";
 | 
				
			||||||
 | 
					        document.getElementById('ErrorMessage').hidden = true;
 | 
				
			||||||
 | 
					        document.getElementById('ErrorMessage').innerHTML="";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function checkRegExpValRusNum(){
 | 
				
			||||||
 | 
					    const strNumDoc = document.querySelector('input[name="strNumDoc"]');
 | 
				
			||||||
 | 
					    strNumDoc.addEventListener('input', updateValueStrNumDoc);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function updateValueStrNumDoc(letter){
 | 
				
			||||||
 | 
					    var reg = /^[-\s,а-яА-ЯёЁ0-9]+$/;
 | 
				
			||||||
 | 
					    var bukva = letter.target.value; //получаем измененную строку
 | 
				
			||||||
 | 
					    var validNum = reg.test(bukva);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!validNum) {
 | 
				
			||||||
 | 
					        var errorText = "Строка с номерами может содержать только кирилицу, тире, числа и запятые \n Пример: ТТ-ЗАК-01234, ЭЛР-СЧ-12345";
 | 
				
			||||||
 | 
					        document.getElementById('ErrorMessage').hidden = false;
 | 
				
			||||||
 | 
					        document.getElementById('ErrorMessage').innerHTML="<HR color='red'>"+
 | 
				
			||||||
 | 
					        "ВНИМАНИЕ: " + errorText.bold() + "<HR color='red'>";
 | 
				
			||||||
 | 
					    }else{
 | 
				
			||||||
 | 
					        var errorText = "";
 | 
				
			||||||
 | 
					        document.getElementById('ErrorMessage').hidden = true;
 | 
				
			||||||
 | 
					        document.getElementById('ErrorMessage').innerHTML="";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//***************** K0t0vICH ***************/
 | 
				
			||||||
 | 
					function send_data(){
 | 
				
			||||||
 | 
						// блочим кнопку отправки запроса
 | 
				
			||||||
 | 
					    //startCheck("submit_btn");
 | 
				
			||||||
 | 
						toggleButton("submit_btn");
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						// удаляем предыдущую таблицу
 | 
				
			||||||
 | 
						if (document.querySelector('#result_table').childNodes.length>0) {
 | 
				
			||||||
 | 
							document.querySelector('#result_table').removeChild(document.querySelector('#result_table').childNodes[0]);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						// Данные формы
 | 
				
			||||||
 | 
					    const params = {
 | 
				
			||||||
 | 
							urfiz: document.querySelector('input[name="urfiz"]:checked').value,
 | 
				
			||||||
 | 
					        INN: document.querySelector('#INN').value,
 | 
				
			||||||
 | 
					        strNumDoc: document.querySelector('#strNumDoc').value
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    var http = new XMLHttpRequest();
 | 
				
			||||||
 | 
					    http.open('POST', 'action.php', true);
 | 
				
			||||||
 | 
					    http.setRequestHeader('Content-type', 'application/json');
 | 
				
			||||||
 | 
						http.onreadystatechange = function() { // Ожидание ответа
 | 
				
			||||||
 | 
						    if(http.readyState == 4 && http.status == 200) {
 | 
				
			||||||
 | 
						        console.log(http.responseText);  // проверка приходящих параметров
 | 
				
			||||||
 | 
						        // разблокируем кнопку отправки запроса
 | 
				
			||||||
 | 
						        toggleButton("submit_btn");
 | 
				
			||||||
 | 
						        
 | 
				
			||||||
 | 
								var result_table = JSON.parse(http.responseText);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// Заголовки таблицы
 | 
				
			||||||
 | 
						        var col = [];
 | 
				
			||||||
 | 
						        for (var i = 0; i < result_table.length; i++) {
 | 
				
			||||||
 | 
						            for (var key in result_table[i]) {
 | 
				
			||||||
 | 
						                if (col.indexOf(key) === -1) {
 | 
				
			||||||
 | 
						                    col.push(key);
 | 
				
			||||||
 | 
						                }
 | 
				
			||||||
 | 
						            }
 | 
				
			||||||
 | 
						        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// Создаем таблицу
 | 
				
			||||||
 | 
						        var table = document.createElement("table");
 | 
				
			||||||
 | 
						        var tr = table.insertRow(-1);                   // TABLE ROW.
 | 
				
			||||||
 | 
						        for (var i = 0; i < col.length; i++) {
 | 
				
			||||||
 | 
						            var th = document.createElement("th");      // TABLE HEADER.
 | 
				
			||||||
 | 
						            th.innerHTML = col[i];
 | 
				
			||||||
 | 
						            tr.appendChild(th);
 | 
				
			||||||
 | 
						        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						        // JSON DATA -> ROWS.
 | 
				
			||||||
 | 
						        for (var i = 0; i < result_table.length; i++) {
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						            tr = table.insertRow(-1);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						            for (var j = 0; j < col.length; j++) {
 | 
				
			||||||
 | 
						                var tabCell = tr.insertCell(-1);
 | 
				
			||||||
 | 
						                tabCell.innerHTML = result_table[i][col[j]];
 | 
				
			||||||
 | 
						            }
 | 
				
			||||||
 | 
						        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						        // Создаем таблицу в контейнере
 | 
				
			||||||
 | 
						        var divContainer = document.getElementById("result_table");
 | 
				
			||||||
 | 
						        divContainer.innerHTML = "";
 | 
				
			||||||
 | 
						        divContainer.appendChild(table);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// скролим строницу на таблицу результатов
 | 
				
			||||||
 | 
						        document.getElementById("result_table").scrollIntoView();
 | 
				
			||||||
 | 
						        
 | 
				
			||||||
 | 
						    }
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					    http.send(JSON.stringify(params)); // упаковываем!
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function startCheck(button_id){
 | 
				
			||||||
 | 
					    var el = document.getElementById(button_id);
 | 
				
			||||||
 | 
					    var urfiz = document.getElementsByName("urfiz");
 | 
				
			||||||
 | 
					    if (!urfiz["ur"].checked && !urfiz["ur"].checked){
 | 
				
			||||||
 | 
					        el.value = "Не выбрано Юр./Физ.лицо"
 | 
				
			||||||
 | 
					        el.disabled = true$
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        el.value = "Получить данные";
 | 
				
			||||||
 | 
					        el.disabled = false; 
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function toggleButton(button_id) 
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					   var el = document.getElementById(button_id);
 | 
				
			||||||
 | 
					   if (el.value == "Запрос обрабатывается...") 
 | 
				
			||||||
 | 
					   {
 | 
				
			||||||
 | 
					       el.value = "Получить данные";
 | 
				
			||||||
 | 
					       el.disabled = false;
 | 
				
			||||||
 | 
					   }
 | 
				
			||||||
 | 
					   else 
 | 
				
			||||||
 | 
					   {
 | 
				
			||||||
 | 
					     el.value = "Запрос обрабатывается...";
 | 
				
			||||||
 | 
					     el.disabled = true;
 | 
				
			||||||
 | 
					   }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,175 @@
 | 
				
			||||||
 | 
					red{
 | 
				
			||||||
 | 
					    color: red;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					divcenter {
 | 
				
			||||||
 | 
					    width: 760px;
 | 
				
			||||||
 | 
					    display: block;
 | 
				
			||||||
 | 
					    top: 5%;
 | 
				
			||||||
 | 
					    left: 25%;
 | 
				
			||||||
 | 
					    position: absolute;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ErrorMessage{
 | 
				
			||||||
 | 
					   color: red;  
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					div.new_form {
 | 
				
			||||||
 | 
					    width: 680px;
 | 
				
			||||||
 | 
					    border: 1px solid red;
 | 
				
			||||||
 | 
					    display: block;
 | 
				
			||||||
 | 
					 }*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 div.new_form {
 | 
				
			||||||
 | 
					    width: 680px;
 | 
				
			||||||
 | 
					    border: 1px solid #cecece;
 | 
				
			||||||
 | 
					    display: block;
 | 
				
			||||||
 | 
					    height: 320px;
 | 
				
			||||||
 | 
					    padding: 40px;     
 | 
				
			||||||
 | 
					    box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 3px 6px rgba(0,0,0,0.22);
 | 
				
			||||||
 | 
					    margin: auto;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					div.new_form input[type="text"] {
 | 
				
			||||||
 | 
					    width: 100%;
 | 
				
			||||||
 | 
					    margin-top: 10px;
 | 
				
			||||||
 | 
					    padding: 10px 0;
 | 
				
			||||||
 | 
					    text-indent: 15px;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 div.new_form input[type="number"] {
 | 
				
			||||||
 | 
					    width: 100%;
 | 
				
			||||||
 | 
					    margin-top: 10px;
 | 
				
			||||||
 | 
					    padding: 10px 0;
 | 
				
			||||||
 | 
					    text-indent: 15px;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 div.new_form input[type="radio"] {
 | 
				
			||||||
 | 
					    width: 15px;
 | 
				
			||||||
 | 
					    padding: 10px 0;
 | 
				
			||||||
 | 
					    text-indent: 1px;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 div.new_form input[type="submit"] {
 | 
				
			||||||
 | 
					    float: right;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 div.new_form input {
 | 
				
			||||||
 | 
					    width: 49%;
 | 
				
			||||||
 | 
					    margin-top: 10px;
 | 
				
			||||||
 | 
					    padding: 10px 0;
 | 
				
			||||||
 | 
					    text-indent: 15px;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 h2.forms {
 | 
				
			||||||
 | 
					    text-align: center;
 | 
				
			||||||
 | 
					    font-family: sans-serif;
 | 
				
			||||||
 | 
					    font-weight: 100;
 | 
				
			||||||
 | 
					    color: #4d5d53;
 | 
				
			||||||
 | 
					    text-transform: uppercase;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 /* начало раскраски кнопок RADIO */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 .form_radio_btn {
 | 
				
			||||||
 | 
					    display: inline-block;
 | 
				
			||||||
 | 
					    /* margin-right: 10px; */
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 .form_radio_btn input[type=radio] {
 | 
				
			||||||
 | 
					    display: none;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 .form_radio_btn label {
 | 
				
			||||||
 | 
					   width: 306px;
 | 
				
			||||||
 | 
					    display: inline-block;
 | 
				
			||||||
 | 
					    cursor: pointer;
 | 
				
			||||||
 | 
					    padding: 0px 15px;
 | 
				
			||||||
 | 
					    line-height: 35px;
 | 
				
			||||||
 | 
					    border: 1px solid #999;
 | 
				
			||||||
 | 
					    border-radius: 6px;
 | 
				
			||||||
 | 
					    user-select: none;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 /* Checked */
 | 
				
			||||||
 | 
					 .form_radio_btn input[type=radio]:checked + label {
 | 
				
			||||||
 | 
					    background: #ffe0a6;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 /* Hover */
 | 
				
			||||||
 | 
					 .form_radio_btn label:hover {
 | 
				
			||||||
 | 
					    color: #666;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 /* Disabled */
 | 
				
			||||||
 | 
					 .form_radio_btn input[type=radio]:disabled + label {
 | 
				
			||||||
 | 
					    background: #efefef;
 | 
				
			||||||
 | 
					    color: #666;
 | 
				
			||||||
 | 
					 } 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 /* конец раскраски кнопок RADIO */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 rezult {
 | 
				
			||||||
 | 
					    display: block;
 | 
				
			||||||
 | 
					    margin: 14px;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 /*
 | 
				
			||||||
 | 
					 #result_table {
 | 
				
			||||||
 | 
					      position:relative;
 | 
				
			||||||
 | 
					      margin-top:70px;
 | 
				
			||||||
 | 
					      top:0;
 | 
				
			||||||
 | 
					      width: 100%;
 | 
				
			||||||
 | 
					      display: block;
 | 
				
			||||||
 | 
					      border: 1px solid #cecece;
 | 
				
			||||||
 | 
					      box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 3px 6px rgba(0,0,0,0.22);
 | 
				
			||||||
 | 
					      margin: auto;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 /* раскраска таблицы */
 | 
				
			||||||
 | 
					 #result_table table {
 | 
				
			||||||
 | 
						font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
 | 
				
			||||||
 | 
						border-collapse: collapse;
 | 
				
			||||||
 | 
						/*width: 600px;*/
 | 
				
			||||||
 | 
					   /*height: 210px;*/
 | 
				
			||||||
 | 
					   padding: 10px;     
 | 
				
			||||||
 | 
					   position:relative;
 | 
				
			||||||
 | 
					   margin-top:15px;
 | 
				
			||||||
 | 
					   top:15px;
 | 
				
			||||||
 | 
					   width: 100%;
 | 
				
			||||||
 | 
					   display: block;
 | 
				
			||||||
 | 
					   border: 1px solid #cecece;
 | 
				
			||||||
 | 
					   box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 3px 6px rgba(0,0,0,0.22);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#result_table table td, table th {
 | 
				
			||||||
 | 
						border: 1px solid #ddd;
 | 
				
			||||||
 | 
						padding: 4px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#result_table table tr:nth-child(even){
 | 
				
			||||||
 | 
						background-color: #f2f2f2;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#result_table table tr:hover {
 | 
				
			||||||
 | 
						background-color: #ddd;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#result_table table th {
 | 
				
			||||||
 | 
						padding-top: 8px;
 | 
				
			||||||
 | 
						padding-bottom: 8px;
 | 
				
			||||||
 | 
						text-align: left;
 | 
				
			||||||
 | 
						background-color: #808583;
 | 
				
			||||||
 | 
						color: white;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#bottom_text p {
 | 
				
			||||||
 | 
					   display: inline-block;
 | 
				
			||||||
 | 
					   position:relative;
 | 
				
			||||||
 | 
					   margin-top: 10px; 
 | 
				
			||||||
 | 
					   border: 1px solid rgb(219, 11, 11);
 | 
				
			||||||
 | 
					   border-radius: 6px;
 | 
				
			||||||
 | 
					   padding: 10px;     
 | 
				
			||||||
 | 
					   top:5px;
 | 
				
			||||||
 | 
					   width: 97%;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- **README.MD** - Непосредственно этот файл, который является инструкцией и описанием всего проекта и расширения.
 | 
					- **README.MD** - Непосредственно этот файл, который является инструкцией и описанием всего проекта и расширения.
 | 
				
			||||||
- **HTTPServices.cfe** - файл расширения, который нужно добавить в рабочую базу 1С ЕМП.
 | 
					- **HTTPServices.cfe** - файл расширения, который нужно добавить в рабочую базу 1С ЕМП.
 | 
				
			||||||
- **HTTPServices\default.vrd** - файл настроек публикации и подключения HTTP сервиса на стороне веб сервера Apache.
 | 
					- **HTTPServices\emp\default.vrd** - файл настроек публикации и подключения HTTP сервиса на стороне веб сервера Apache.
 | 
				
			||||||
 | 
					- **HTTPServices\statusform** - папка с файлами виджета, которую нужно настроить и перенести на сторону каталога сайта.
 | 
				
			||||||
 | 
					- **HTTPServices\statusform\action.php** - файл обработка, производит непосредственный запрос на сторону нашего веб сервера, для связи с HTTP сервисом. В этом файле нужно указать внешний путь к опубликованному сервису.
 | 
				
			||||||
- **HTTPServises\apache.conf** - файл с блоком настроек на стороне веб сервера Apache, для реализации публикации HTTP сервиса во вне.
 | 
					- **HTTPServises\apache.conf** - файл с блоком настроек на стороне веб сервера Apache, для реализации публикации HTTP сервиса во вне.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Источники вдохновения, основа кода расширения, и чтиво для понимания. (ссылки)
 | 
					## Источники вдохновения, основа кода расширения, и чтиво для понимания. (ссылки)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue