forked from mirzaev/site-tordv-calculator
		
	готов интерфейс профнастила, начата работа над 3д сеткой и евроштакетом
This commit is contained in:
		@@ -134,14 +134,11 @@ final class calculator_controller extends core
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Лазерная резка
 | 
			
		||||
     * Профнастил 
 | 
			
		||||
     *
 | 
			
		||||
     * HTML-код с калькулятором лазерной резки
 | 
			
		||||
     * HTML-код с калькулятором профнастила
 | 
			
		||||
     *
 | 
			
		||||
     * @param array $vars Параметры
 | 
			
		||||
     *
 | 
			
		||||
     * @todo 1. Заголовок калькулятора должен находиться внутри элемента калькулятора
 | 
			
		||||
     * 2. Ограничение значений полей в зависимости от выбранной марки
 | 
			
		||||
     */
 | 
			
		||||
    public function profnastil(array $vars = []): ?string
 | 
			
		||||
    {
 | 
			
		||||
@@ -150,8 +147,6 @@ final class calculator_controller extends core
 | 
			
		||||
 | 
			
		||||
      // Инициализация данных калькулятора
 | 
			
		||||
      $vars['calculators'] = ['profnastil' => [
 | 
			
		||||
        'company' => settings::read('default_buyer', $vars['errors']['calculators']),
 | 
			
		||||
        'complexity' => settings::read('default_complexity', $vars['errors']['calculators']),
 | 
			
		||||
        'width' => (int) round((float) settings::read('default_width', $vars['errors']['calculators'])),
 | 
			
		||||
        'height' => (int) round((float) settings::read('default_height', $vars['errors']['calculators'])),
 | 
			
		||||
        'length' => (int) round((float) settings::read('default_length', $vars['errors']['calculators'])),
 | 
			
		||||
@@ -165,6 +160,60 @@ final class calculator_controller extends core
 | 
			
		||||
      return $this->view->render(DIRECTORY_SEPARATOR . 'calculators' . DIRECTORY_SEPARATOR . 'profnastil.html', $vars);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 3D-сетка 
 | 
			
		||||
     *
 | 
			
		||||
     * HTML-код с калькулятором 3D-сетки
 | 
			
		||||
     *
 | 
			
		||||
     * @param array $vars Параметры
 | 
			
		||||
     */
 | 
			
		||||
    public function setka(array $vars = []): ?string
 | 
			
		||||
    {
 | 
			
		||||
      // Инициализация журнала ошибок
 | 
			
		||||
      $vars['errors'] = ['calculators' => []];
 | 
			
		||||
 | 
			
		||||
      // Инициализация данных калькулятора
 | 
			
		||||
      $vars['calculators'] = ['profnastil' => [
 | 
			
		||||
        'width' => (int) round((float) settings::read('default_width', $vars['errors']['calculators'])),
 | 
			
		||||
        'height' => (int) round((float) settings::read('default_height', $vars['errors']['calculators'])),
 | 
			
		||||
        'length' => (int) round((float) settings::read('default_length', $vars['errors']['calculators'])),
 | 
			
		||||
        'amount' => (int) round((float) settings::read('default_amount', $vars['errors']['calculators'])),
 | 
			
		||||
        'type' => settings::read('default_type', $vars['errors']['calculators']),
 | 
			
		||||
        'holes' => (int) round((float) settings::read('default_holes', $vars['errors']['calculators'])),
 | 
			
		||||
        'diameter' => (float) settings::read('default_diameter', $vars['errors']['calculators'])
 | 
			
		||||
        ]];
 | 
			
		||||
 | 
			
		||||
      // Генерация представления
 | 
			
		||||
      return $this->view->render(DIRECTORY_SEPARATOR . 'calculators' . DIRECTORY_SEPARATOR . 'setka.html', $vars);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Евроштакет
 | 
			
		||||
     *
 | 
			
		||||
     * HTML-код с калькулятором евроштакета
 | 
			
		||||
     *
 | 
			
		||||
     * @param array $vars Параметры
 | 
			
		||||
     */
 | 
			
		||||
    public function evroshtaket(array $vars = []): ?string
 | 
			
		||||
    {
 | 
			
		||||
      // Инициализация журнала ошибок
 | 
			
		||||
      $vars['errors'] = ['calculators' => []];
 | 
			
		||||
 | 
			
		||||
      // Инициализация данных калькулятора
 | 
			
		||||
      $vars['calculators'] = ['profnastil' => [
 | 
			
		||||
        'width' => (int) round((float) settings::read('default_width', $vars['errors']['calculators'])),
 | 
			
		||||
        'height' => (int) round((float) settings::read('default_height', $vars['errors']['calculators'])),
 | 
			
		||||
        'length' => (int) round((float) settings::read('default_length', $vars['errors']['calculators'])),
 | 
			
		||||
        'amount' => (int) round((float) settings::read('default_amount', $vars['errors']['calculators'])),
 | 
			
		||||
        'type' => settings::read('default_type', $vars['errors']['calculators']),
 | 
			
		||||
        'holes' => (int) round((float) settings::read('default_holes', $vars['errors']['calculators'])),
 | 
			
		||||
        'diameter' => (float) settings::read('default_diameter', $vars['errors']['calculators'])
 | 
			
		||||
        ]];
 | 
			
		||||
 | 
			
		||||
      // Генерация представления
 | 
			
		||||
      return $this->view->render(DIRECTORY_SEPARATOR . 'calculators' . DIRECTORY_SEPARATOR . 'evroshtaket.html', $vars);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Расчёт
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -1,96 +1,92 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
let calculator = {
 | 
			
		||||
const calculator = {
 | 
			
		||||
  index: document.getElementById("calculator"),
 | 
			
		||||
  calculators: [],
 | 
			
		||||
  account: [],
 | 
			
		||||
  settings: {
 | 
			
		||||
    defaults: {
 | 
			
		||||
      buyer: 'individual',
 | 
			
		||||
      complexity: 'medium',
 | 
			
		||||
    }
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  init() {
 | 
			
		||||
    // Инициализация калькулятора
 | 
			
		||||
 | 
			
		||||
    this.generate.buyer(this.settings.defaults.buyer)
 | 
			
		||||
    this.generate.menu()
 | 
			
		||||
      .then(
 | 
			
		||||
        success => {
 | 
			
		||||
          this.generate.complexity(this.settings.defaults.complexity)
 | 
			
		||||
        () => {
 | 
			
		||||
          this.authenticate(cookie.read("id"))
 | 
			
		||||
            .then(
 | 
			
		||||
              success => {
 | 
			
		||||
                this.generate.menu()
 | 
			
		||||
                  .then(
 | 
			
		||||
                    success => {
 | 
			
		||||
                      this.authenticate(cookie.read('id'))
 | 
			
		||||
                        .then(
 | 
			
		||||
                          success => {
 | 
			
		||||
                            // Запись данных аккаунта
 | 
			
		||||
                            this.account = success;
 | 
			
		||||
              (success) => {
 | 
			
		||||
                // Запись данных аккаунта
 | 
			
		||||
                this.account = success;
 | 
			
		||||
 | 
			
		||||
                            if (this.account !== undefined && typeof this.account === 'object' && this.account.permissions !== undefined) {
 | 
			
		||||
                              // Найден аккаунт
 | 
			
		||||
                if (
 | 
			
		||||
                  this.account !== undefined &&
 | 
			
		||||
                  typeof this.account === "object" &&
 | 
			
		||||
                  this.account.permissions !== undefined
 | 
			
		||||
                ) {
 | 
			
		||||
                  // Найден аккаунт
 | 
			
		||||
 | 
			
		||||
                              if (this.account.permissions.calculate == 1) {
 | 
			
		||||
                                // Разрешено использовать калькулятор
 | 
			
		||||
                  if (this.account.permissions.calculate == 1) {
 | 
			
		||||
                    // Разрешено использовать калькулятор
 | 
			
		||||
 | 
			
		||||
                                this.generate.result();
 | 
			
		||||
                              }
 | 
			
		||||
                            }
 | 
			
		||||
                          }
 | 
			
		||||
                        );
 | 
			
		||||
                    }
 | 
			
		||||
                  );
 | 
			
		||||
              }
 | 
			
		||||
                    this.generate.result();
 | 
			
		||||
                  }
 | 
			
		||||
                }
 | 
			
		||||
              },
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
      );
 | 
			
		||||
 | 
			
		||||
    console.log('[КАЛЬКУЛЯТОР] Инициализирован');
 | 
			
		||||
    console.log("[КАЛЬКУЛЯТОР] Инициализирован");
 | 
			
		||||
  },
 | 
			
		||||
  authenticate(id) {
 | 
			
		||||
  async authenticate(id) {
 | 
			
		||||
    // Запрос и генерация HTML с данными о типе покупателя (юр. лицо и физ. лицо)'
 | 
			
		||||
 | 
			
		||||
    return fetch('/account/data?id=' + id, {
 | 
			
		||||
    return await fetch("/account/data?id=" + id, {
 | 
			
		||||
      method: "POST",
 | 
			
		||||
      headers: { "content-type": "application/x-www-form-urlencoded" }
 | 
			
		||||
      headers: { "content-type": "application/x-www-form-urlencoded" },
 | 
			
		||||
    }).then((response) => {
 | 
			
		||||
      if (response.status === 200) {
 | 
			
		||||
        return response.json().then(
 | 
			
		||||
          success => {
 | 
			
		||||
            console.log('[КАЛЬКУЛЯТОР] Загружены данные пользователя: ' + id);
 | 
			
		||||
          (success) => {
 | 
			
		||||
            console.log("[КАЛЬКУЛЯТОР] Загружены данные пользователя: " + id);
 | 
			
		||||
 | 
			
		||||
            return success;
 | 
			
		||||
          },
 | 
			
		||||
          error => {
 | 
			
		||||
            console.log('[КАЛЬКУЛЯТОР] [ОШИБКА] Не удалось загрузить данные пользователя: ' + id);
 | 
			
		||||
          }
 | 
			
		||||
          () => {
 | 
			
		||||
            console.log(
 | 
			
		||||
              "[КАЛЬКУЛЯТОР] [ОШИБКА] Не удалось загрузить данные пользователя: " +
 | 
			
		||||
                id,
 | 
			
		||||
            );
 | 
			
		||||
          },
 | 
			
		||||
        );
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
  calculate() {
 | 
			
		||||
  async calculate() {
 | 
			
		||||
    // Запрос и генерация HTML с данными о рассчете со всех калькуляторов
 | 
			
		||||
 | 
			
		||||
    // Инициализация параметров
 | 
			
		||||
    let cutting = document.getElementById('cutting');
 | 
			
		||||
    let discount = document.getElementById('discount');
 | 
			
		||||
    const cutting = document.getElementById("cutting");
 | 
			
		||||
    const discount = document.getElementById("discount");
 | 
			
		||||
 | 
			
		||||
    // Инициализация буфера запроса
 | 
			
		||||
    let query = {
 | 
			
		||||
    const query = {
 | 
			
		||||
      calculators: {},
 | 
			
		||||
      cutting: +cutting.value ?? 0,
 | 
			
		||||
      discount: +discount.value ?? 0
 | 
			
		||||
      discount: +discount.value ?? 0,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    for (const number in this.calculators) {
 | 
			
		||||
      // Перебор калькуляторов
 | 
			
		||||
 | 
			
		||||
      // Инициализация буфера запроса для нового калькулятора
 | 
			
		||||
      query['calculators'][number] = {};
 | 
			
		||||
      query["calculators"][number] = {};
 | 
			
		||||
 | 
			
		||||
      // Инициализация типа калькулятора
 | 
			
		||||
      query['calculators'][number]['calculator'] = this.calculators[number].getAttribute('data-calculator');
 | 
			
		||||
      query["calculators"][number]["calculator"] = this.calculators[number]
 | 
			
		||||
        .getAttribute("data-calculator");
 | 
			
		||||
 | 
			
		||||
      for (const buyer of this.index.querySelectorAll('input[name="buyer"]')) {
 | 
			
		||||
        // Перебор полей с параметрами типа заказчика
 | 
			
		||||
@@ -99,51 +95,69 @@ let calculator = {
 | 
			
		||||
          // Найдено выбранное поле
 | 
			
		||||
 | 
			
		||||
          // Запись в буфер запроса
 | 
			
		||||
          query['calculators'][number]['buyer'] = buyer.value;
 | 
			
		||||
          query["calculators"][number]["buyer"] = buyer.value;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      for (const complexity of this.index.querySelectorAll('input[name="complexity"]')) {
 | 
			
		||||
      for (
 | 
			
		||||
        const complexity of this.index.querySelectorAll(
 | 
			
		||||
          'input[name="complexity"]',
 | 
			
		||||
        )
 | 
			
		||||
      ) {
 | 
			
		||||
        // Перебор полей с параметрами сложности
 | 
			
		||||
 | 
			
		||||
        if (complexity.checked) {
 | 
			
		||||
          // Найдено выбранное поле
 | 
			
		||||
 | 
			
		||||
          // Запись в буфер запроса
 | 
			
		||||
          query['calculators'][number]['complexity'] = complexity.value;
 | 
			
		||||
          query["calculators"][number]["complexity"] = complexity.value;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      for (const field of this.calculators[number].querySelectorAll('[data-calculator-parameter]')) {
 | 
			
		||||
      for (
 | 
			
		||||
        const field of this.calculators[number].querySelectorAll(
 | 
			
		||||
          "[data-calculator-parameter]",
 | 
			
		||||
        )
 | 
			
		||||
      ) {
 | 
			
		||||
        // Перебор полей с параметрами
 | 
			
		||||
 | 
			
		||||
        if (field.getAttribute('type') === 'checkbox') {
 | 
			
		||||
        if (field.getAttribute("type") === "checkbox") {
 | 
			
		||||
          // Флажок
 | 
			
		||||
 | 
			
		||||
          // Запись в буфер запроса
 | 
			
		||||
          query['calculators'][number][field.getAttribute('data-calculator-parameter')] = field.checked;
 | 
			
		||||
        } else if (field.getAttribute('type') === 'text' || field.getAttribute('type') === 'number' || field.getAttribute('type') === 'range') {
 | 
			
		||||
          query["calculators"][number][
 | 
			
		||||
            field.getAttribute("data-calculator-parameter")
 | 
			
		||||
          ] = field.checked;
 | 
			
		||||
        } else if (
 | 
			
		||||
          field.getAttribute("type") === "text" ||
 | 
			
		||||
          field.getAttribute("type") === "number" ||
 | 
			
		||||
          field.getAttribute("type") === "range"
 | 
			
		||||
        ) {
 | 
			
		||||
          // Текстовое, цифровое поле или ползунок
 | 
			
		||||
 | 
			
		||||
          // Запись в буфер запроса
 | 
			
		||||
          query['calculators'][number][field.getAttribute('data-calculator-parameter')] = field.value;
 | 
			
		||||
          query["calculators"][number][
 | 
			
		||||
            field.getAttribute("data-calculator-parameter")
 | 
			
		||||
          ] = field.value;
 | 
			
		||||
        } else {
 | 
			
		||||
          // Элемент с тегом <select> (подразумевается)
 | 
			
		||||
 | 
			
		||||
          // Запись в буфер запроса
 | 
			
		||||
          query['calculators'][number][field.getAttribute('data-calculator-parameter')] = field.value ?? field.options[field.selectedIndex].text;
 | 
			
		||||
          query["calculators"][number][
 | 
			
		||||
            field.getAttribute("data-calculator-parameter")
 | 
			
		||||
          ] = field.value ?? field.options[field.selectedIndex].text;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return fetch('/calculator/calculate', {
 | 
			
		||||
    return await fetch("/calculator/calculate", {
 | 
			
		||||
      method: "POST",
 | 
			
		||||
      headers: { "content-type": "application/json" },
 | 
			
		||||
      body: JSON.stringify(query)
 | 
			
		||||
      body: JSON.stringify(query),
 | 
			
		||||
    }).then((response) => {
 | 
			
		||||
      if (response.status === 200) {
 | 
			
		||||
        response.json().then(
 | 
			
		||||
          success => {
 | 
			
		||||
          (success) => {
 | 
			
		||||
            // Инициализация буфера расходов
 | 
			
		||||
            let expenses = 0;
 | 
			
		||||
 | 
			
		||||
@@ -154,7 +168,7 @@ let calculator = {
 | 
			
		||||
              // Найдены ошибки
 | 
			
		||||
 | 
			
		||||
              // Генерация текста ответа
 | 
			
		||||
              result = 'Ошибка';
 | 
			
		||||
              result = "Ошибка";
 | 
			
		||||
            } else {
 | 
			
		||||
              // Не найдены ошибки
 | 
			
		||||
 | 
			
		||||
@@ -163,10 +177,11 @@ let calculator = {
 | 
			
		||||
 | 
			
		||||
                // Запись полученных данных
 | 
			
		||||
                cutting.value = success.other.cutting;
 | 
			
		||||
                cutting.parentElement.children[0].innerText = 'Длина реза 1 детали (' + cutting.value + 'мм)';
 | 
			
		||||
                cutting.parentElement.children[0].innerText =
 | 
			
		||||
                  "Длина реза 1 детали (" + cutting.value + "мм)";
 | 
			
		||||
 | 
			
		||||
                // Разблокировка параметра
 | 
			
		||||
                cutting.removeAttribute('disabled');
 | 
			
		||||
                cutting.removeAttribute("disabled");
 | 
			
		||||
              }
 | 
			
		||||
 | 
			
		||||
              if (success.other.discount !== undefined) {
 | 
			
		||||
@@ -174,14 +189,15 @@ let calculator = {
 | 
			
		||||
 | 
			
		||||
                // Запись полученных данных
 | 
			
		||||
                discount.value = success.other.discount;
 | 
			
		||||
                discount.parentElement.children[0].innerText = 'Скидка (' + discount.value + '%)';
 | 
			
		||||
                discount.parentElement.children[0].innerText = "Скидка (" +
 | 
			
		||||
                  discount.value + "%)";
 | 
			
		||||
              }
 | 
			
		||||
 | 
			
		||||
              for (const [, machine] of Object.entries(success.machines)) {
 | 
			
		||||
                // Перебор станков
 | 
			
		||||
 | 
			
		||||
                // Прибавление данных станка к буферу расходов
 | 
			
		||||
                expenses += (machine.electricity + (machine.metal ?? 0));
 | 
			
		||||
                expenses += machine.electricity + (machine.metal ?? 0);
 | 
			
		||||
 | 
			
		||||
                // Прибавление амортизации к буферу вывода
 | 
			
		||||
                expenses += machine.reprocessing ?? 0;
 | 
			
		||||
@@ -208,7 +224,8 @@ let calculator = {
 | 
			
		||||
                // Перебор операторов
 | 
			
		||||
 | 
			
		||||
                // Прибавление данных оператора к буферу расходов
 | 
			
		||||
                expenses += (operator.time.design + operator.time.machine) * operator.hour;
 | 
			
		||||
                expenses += (operator.time.design + operator.time.machine) *
 | 
			
		||||
                  operator.hour;
 | 
			
		||||
              }
 | 
			
		||||
 | 
			
		||||
              for (const [, handyman] of Object.entries(success.handymans)) {
 | 
			
		||||
@@ -237,124 +254,102 @@ let calculator = {
 | 
			
		||||
              expenses = expenses.toFixed(2);
 | 
			
		||||
 | 
			
		||||
              // Генерация текста ответа
 | 
			
		||||
              result = expenses + ' рублей';
 | 
			
		||||
              result = expenses + " рублей";
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (this.generate.result(result)) {
 | 
			
		||||
              console.log(`[КАЛЬКУЛЯТОР] Сгенерирован результат: ${expenses} рублей`);
 | 
			
		||||
              console.log(
 | 
			
		||||
                `[КАЛЬКУЛЯТОР] Сгенерирован результат: ${expenses} рублей`,
 | 
			
		||||
              );
 | 
			
		||||
            } else {
 | 
			
		||||
              console.log('[КАЛЬКУЛЯТОР] [ОШИБКА] Не удалось сгенерировать результат');
 | 
			
		||||
              console.log(
 | 
			
		||||
                "[КАЛЬКУЛЯТОР] [ОШИБКА] Не удалось сгенерировать результат",
 | 
			
		||||
              );
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          error => {
 | 
			
		||||
            console.log('[КАЛЬКУЛЯТОР] [ОШИБКА] Не удалось сгенерировать результат');
 | 
			
		||||
          });
 | 
			
		||||
          () => {
 | 
			
		||||
            console.log(
 | 
			
		||||
              "[КАЛЬКУЛЯТОР] [ОШИБКА] Не удалось сгенерировать результат",
 | 
			
		||||
            );
 | 
			
		||||
          },
 | 
			
		||||
        );
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
  generate: {
 | 
			
		||||
    buyer(value = 'individual') {
 | 
			
		||||
      // Запрос и генерация HTML с данными о типе покупателя (юр. лицо и физ. лицо)
 | 
			
		||||
 | 
			
		||||
      return fetch('/calculator/generate/buyer?value=' + value, {
 | 
			
		||||
        method: "POST",
 | 
			
		||||
        headers: { "content-type": "application/x-www-form-urlencoded" }
 | 
			
		||||
      }).then((response) => {
 | 
			
		||||
        if (response.status === 200) {
 | 
			
		||||
          response.text().then(
 | 
			
		||||
            success => {
 | 
			
		||||
              calculator.index.insertAdjacentHTML('beforeend', success);
 | 
			
		||||
 | 
			
		||||
              console.log('[КАЛЬКУЛЯТОР] Загружен элемент с кнопками выбора типа покупателя');
 | 
			
		||||
            },
 | 
			
		||||
            error => {
 | 
			
		||||
              console.log('[КАЛЬКУЛЯТОР] [ОШИБКА] Не удалось загрузить элемент с кнопками выбора типа покупателя');
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    complexity(value = 'medium') {
 | 
			
		||||
      // Запрос и генерация HTML с данными о сложности работы
 | 
			
		||||
 | 
			
		||||
      return fetch('/calculator/generate/complexity?value=' + value, {
 | 
			
		||||
        method: "POST",
 | 
			
		||||
        headers: { "content-type": "application/x-www-form-urlencoded" }
 | 
			
		||||
      }).then((response) => {
 | 
			
		||||
        if (response.status === 200) {
 | 
			
		||||
          response.text().then(
 | 
			
		||||
            success => {
 | 
			
		||||
              calculator.index.insertAdjacentHTML('beforeend', success);
 | 
			
		||||
 | 
			
		||||
              console.log('[КАЛЬКУЛЯТОР] Загружен элемент с кнопками выбора сложности');
 | 
			
		||||
            },
 | 
			
		||||
            error => {
 | 
			
		||||
              console.log('[КАЛЬКУЛЯТОР] [ОШИБКА] Не удалось загрузить элемент с кнопками выбора сложности');
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    menu() {
 | 
			
		||||
    async menu() {
 | 
			
		||||
      // Запрос и генерация HTML с кнопками добавления калькулятора
 | 
			
		||||
 | 
			
		||||
      return fetch('/calculator/generate/menu', {
 | 
			
		||||
      return await fetch("/calculator/generate/menu", {
 | 
			
		||||
        method: "POST",
 | 
			
		||||
        headers: { "content-type": "application/x-www-form-urlencoded" }
 | 
			
		||||
        headers: { "content-type": "application/x-www-form-urlencoded" },
 | 
			
		||||
      }).then((response) => {
 | 
			
		||||
        if (response.status === 200) {
 | 
			
		||||
          response.text().then(
 | 
			
		||||
            success => {
 | 
			
		||||
              calculator.index.insertAdjacentHTML('beforeend', success);
 | 
			
		||||
            (success) => {
 | 
			
		||||
              calculator.index.insertAdjacentHTML("beforeend", success);
 | 
			
		||||
 | 
			
		||||
              console.log('[КАЛЬКУЛЯТОР] Загружен элемент с кнопками добавления калькулятора');
 | 
			
		||||
              console.log(
 | 
			
		||||
                "[КАЛЬКУЛЯТОР] Загружен элемент с кнопками добавления калькулятора",
 | 
			
		||||
              );
 | 
			
		||||
            },
 | 
			
		||||
            error => {
 | 
			
		||||
              console.log('[КАЛЬКУЛЯТОР] [ОШИБКА] Не удалось загрузить элемент с кнопками добавления калькулятора');
 | 
			
		||||
            });
 | 
			
		||||
            () => {
 | 
			
		||||
              console.log(
 | 
			
		||||
                "[КАЛЬКУЛЯТОР] [ОШИБКА] Не удалось загрузить элемент с кнопками добавления калькулятора",
 | 
			
		||||
              );
 | 
			
		||||
            },
 | 
			
		||||
          );
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    fence(element, type = 1) {
 | 
			
		||||
    async fence(element, type = 1) {
 | 
			
		||||
      // Генерация полей с выбором типа забора
 | 
			
		||||
 | 
			
		||||
      return fetch('/calculator/generate/fence?type=' + type, {
 | 
			
		||||
      return await fetch("/calculator/generate/fence?type=" + type, {
 | 
			
		||||
        method: "POST",
 | 
			
		||||
        headers: { "content-type": "application/x-www-form-urlencoded" }
 | 
			
		||||
        headers: { "content-type": "application/x-www-form-urlencoded" },
 | 
			
		||||
      }).then((response) => {
 | 
			
		||||
        if (response.status === 200) {
 | 
			
		||||
          response.text().then(
 | 
			
		||||
            success => {
 | 
			
		||||
            (success) => {
 | 
			
		||||
              // Поиск оболочки списка
 | 
			
		||||
              let wrap = element.querySelectorAll('select[name="fence"]')[0];
 | 
			
		||||
              const wrap = element.querySelectorAll('select[name="fence"]')[0];
 | 
			
		||||
 | 
			
		||||
              // Запись полученного списка в оболочку
 | 
			
		||||
              wrap.parentElement.parentElement.insertAdjacentHTML('afterend', success);
 | 
			
		||||
              wrap.parentElement.parentElement.insertAdjacentHTML(
 | 
			
		||||
                "afterend",
 | 
			
		||||
                success,
 | 
			
		||||
              );
 | 
			
		||||
 | 
			
		||||
              // Удаление старого списка
 | 
			
		||||
              if (wrap !== undefined) wrap.parentElement.parentElement.remove();
 | 
			
		||||
 | 
			
		||||
              console.log('[КАЛЬКУЛЯТОР] Загружен список с типами забора');
 | 
			
		||||
              console.log("[КАЛЬКУЛЯТОР] Загружен список с типами забора");
 | 
			
		||||
            },
 | 
			
		||||
            error => {
 | 
			
		||||
              console.log('[КАЛЬКУЛЯТОР] [ОШИБКА] Не удалось загрузить список с типами забора');
 | 
			
		||||
            });
 | 
			
		||||
            () => {
 | 
			
		||||
              console.log(
 | 
			
		||||
                "[КАЛЬКУЛЯТОР] [ОШИБКА] Не удалось загрузить список с типами забора",
 | 
			
		||||
              );
 | 
			
		||||
            },
 | 
			
		||||
          );
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    divider(element, position) {
 | 
			
		||||
    async divider(element, position) {
 | 
			
		||||
      // Запрос и генерация HTML с данными о результате калькуляции
 | 
			
		||||
 | 
			
		||||
      return fetch('/calculator/generate/divider', {
 | 
			
		||||
      return await fetch("/calculator/generate/divider", {
 | 
			
		||||
        method: "POST",
 | 
			
		||||
        headers: { "content-type": "application/x-www-form-urlencoded" }
 | 
			
		||||
        headers: { "content-type": "application/x-www-form-urlencoded" },
 | 
			
		||||
      }).then((response) => {
 | 
			
		||||
        if (response.status === 200) {
 | 
			
		||||
          response.text().then(
 | 
			
		||||
            success => {
 | 
			
		||||
            (success) => {
 | 
			
		||||
              if (element === undefined || position === undefined) {
 | 
			
		||||
                // Не задан элемент и позиция добавляемого разделителя
 | 
			
		||||
 | 
			
		||||
                // Запись разделителя в конце калькулятора
 | 
			
		||||
                calculator.index.insertAdjacentHTML('beforeend', success);
 | 
			
		||||
                calculator.index.insertAdjacentHTML("beforeend", success);
 | 
			
		||||
              } else {
 | 
			
		||||
                // Задан элемент и позиция добавляемого разделителя
 | 
			
		||||
 | 
			
		||||
@@ -362,32 +357,40 @@ let calculator = {
 | 
			
		||||
                element.insertAdjacentHTML(position, success);
 | 
			
		||||
              }
 | 
			
		||||
 | 
			
		||||
              console.log('[КАЛЬКУЛЯТОР] Загружен разделитель');
 | 
			
		||||
              console.log("[КАЛЬКУЛЯТОР] Загружен разделитель");
 | 
			
		||||
            },
 | 
			
		||||
            error => {
 | 
			
		||||
              console.log('[КАЛЬКУЛЯТОР] [ОШИБКА] Не удалось загрузить разделитель');
 | 
			
		||||
            });
 | 
			
		||||
            () => {
 | 
			
		||||
              console.log(
 | 
			
		||||
                "[КАЛЬКУЛЯТОР] [ОШИБКА] Не удалось загрузить разделитель",
 | 
			
		||||
              );
 | 
			
		||||
            },
 | 
			
		||||
          );
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    result(expenses) {
 | 
			
		||||
      // Запрос и генерация HTML с данными о результате калькуляции
 | 
			
		||||
 | 
			
		||||
      function request() {
 | 
			
		||||
        return fetch('/calculator/generate/result', {
 | 
			
		||||
      async function request() {
 | 
			
		||||
        return await fetch("/calculator/generate/result", {
 | 
			
		||||
          method: "POST",
 | 
			
		||||
          headers: { "content-type": "application/x-www-form-urlencoded" }
 | 
			
		||||
          headers: { "content-type": "application/x-www-form-urlencoded" },
 | 
			
		||||
        }).then((response) => {
 | 
			
		||||
          if (response.status === 200) {
 | 
			
		||||
            response.text().then(
 | 
			
		||||
              success => {
 | 
			
		||||
                calculator.index.insertAdjacentHTML('beforeend', success);
 | 
			
		||||
              (success) => {
 | 
			
		||||
                calculator.index.insertAdjacentHTML("beforeend", success);
 | 
			
		||||
 | 
			
		||||
                console.log('[КАЛЬКУЛЯТОР] Загружен элемент с данными о результате калькуляции');
 | 
			
		||||
                console.log(
 | 
			
		||||
                  "[КАЛЬКУЛЯТОР] Загружен элемент с данными о результате калькуляции",
 | 
			
		||||
                );
 | 
			
		||||
              },
 | 
			
		||||
              error => {
 | 
			
		||||
                console.log('[КАЛЬКУЛЯТОР] [ОШИБКА] Не удалось загрузить элемент с данными о результате калькуляции');
 | 
			
		||||
              });
 | 
			
		||||
              () => {
 | 
			
		||||
                console.log(
 | 
			
		||||
                  "[КАЛЬКУЛЯТОР] [ОШИБКА] Не удалось загрузить элемент с данными о результате калькуляции",
 | 
			
		||||
                );
 | 
			
		||||
              },
 | 
			
		||||
            );
 | 
			
		||||
          }
 | 
			
		||||
        });
 | 
			
		||||
      }
 | 
			
		||||
@@ -401,7 +404,7 @@ let calculator = {
 | 
			
		||||
          // Переданы расходы
 | 
			
		||||
 | 
			
		||||
          // Инициализация элемента
 | 
			
		||||
          let element = document.getElementById('calculate');
 | 
			
		||||
          const element = document.getElementById("calculate");
 | 
			
		||||
 | 
			
		||||
          if (element == null) {
 | 
			
		||||
            // Не найден элемент с результатом расчёта
 | 
			
		||||
@@ -424,11 +427,11 @@ let calculator = {
 | 
			
		||||
      // Инициализация количества обработанных ошибок
 | 
			
		||||
      let amount = 0;
 | 
			
		||||
 | 
			
		||||
      if (typeof errors === 'object') {
 | 
			
		||||
      if (typeof errors === "object") {
 | 
			
		||||
        // Передан массив с ошибками и он является массивом
 | 
			
		||||
 | 
			
		||||
        // Инициализация буфера для проверки вложенности массива
 | 
			
		||||
        let first = Object.values(errors)[0];
 | 
			
		||||
        const first = Object.values(errors)[0];
 | 
			
		||||
 | 
			
		||||
        if (first !== undefined && first.text === undefined) {
 | 
			
		||||
          // Найден массив с ошибками (категория)
 | 
			
		||||
@@ -439,10 +442,10 @@ let calculator = {
 | 
			
		||||
          // Не найден массив с ошибками (подразумевается, что это и есть информация об ошибке)
 | 
			
		||||
 | 
			
		||||
          // Инициализация элемента-оболочки
 | 
			
		||||
          let list = document.getElementById('errors');
 | 
			
		||||
          const list = document.getElementById("errors");
 | 
			
		||||
 | 
			
		||||
          // Перезапись данных об ошибках
 | 
			
		||||
          list.innerText = '';
 | 
			
		||||
          list.innerText = "";
 | 
			
		||||
 | 
			
		||||
          // Проверка на наличие ошибок
 | 
			
		||||
          if (errors.length === 0) return false;
 | 
			
		||||
@@ -454,22 +457,22 @@ let calculator = {
 | 
			
		||||
              // Перебор станков
 | 
			
		||||
 | 
			
		||||
              // Инициализация элемента-заголовка
 | 
			
		||||
              let term = document.createElement('dt');
 | 
			
		||||
              const term = document.createElement("dt");
 | 
			
		||||
 | 
			
		||||
              // Запись содержимого
 | 
			
		||||
              term.innerText = error.text;
 | 
			
		||||
 | 
			
		||||
              // Инициализация элемента-описания
 | 
			
		||||
              let definition = document.createElement('dd');
 | 
			
		||||
              const definition = document.createElement("dd");
 | 
			
		||||
 | 
			
		||||
              // Запись содержимого
 | 
			
		||||
              definition.innerText = error.file + ' в строке ' + error.line;
 | 
			
		||||
              definition.innerText = error.file + " в строке " + error.line;
 | 
			
		||||
 | 
			
		||||
              // input.setAttribute('id', element.id);
 | 
			
		||||
 | 
			
		||||
              // Запись в список
 | 
			
		||||
              list.insertAdjacentElement('beforeend', term);
 | 
			
		||||
              list.insertAdjacentElement('beforeend', definition);
 | 
			
		||||
              list.insertAdjacentElement("beforeend", term);
 | 
			
		||||
              list.insertAdjacentElement("beforeend", definition);
 | 
			
		||||
 | 
			
		||||
              // Добавление к счётчику обработанных ошибок
 | 
			
		||||
              ++amount;
 | 
			
		||||
@@ -481,88 +484,105 @@ let calculator = {
 | 
			
		||||
      return amount;
 | 
			
		||||
    },
 | 
			
		||||
    calculators: {
 | 
			
		||||
      profnastil() {
 | 
			
		||||
      async profnastil() {
 | 
			
		||||
        // Запрос и генерация HTML с калькулятором лазерной резки
 | 
			
		||||
 | 
			
		||||
        function write(target, position, html) {
 | 
			
		||||
          if (target === undefined || position === undefined || html === undefined) return false;
 | 
			
		||||
          if (
 | 
			
		||||
            target === undefined || position === undefined || html === undefined
 | 
			
		||||
          ) return false;
 | 
			
		||||
 | 
			
		||||
          // Запись калькулятора после последнего калькулятора
 | 
			
		||||
          target.insertAdjacentHTML(position, html);
 | 
			
		||||
 | 
			
		||||
          // Поиск калькуляторов
 | 
			
		||||
          let calculators = calculator.index.querySelectorAll('section[data-calculator]');
 | 
			
		||||
          const calculators = calculator.index.querySelectorAll(
 | 
			
		||||
            "section[data-calculator]",
 | 
			
		||||
          );
 | 
			
		||||
 | 
			
		||||
          // Инициализация идентификатора калькулятора
 | 
			
		||||
          let id = calculators.length - 1;
 | 
			
		||||
          const id = calculators.length - 1;
 | 
			
		||||
 | 
			
		||||
          // Запись калькулятору его идентификатора
 | 
			
		||||
          calculators[id].id = 'profnastil_' + id;
 | 
			
		||||
          calculators[id].id = "profnastil_" + id;
 | 
			
		||||
 | 
			
		||||
          // Запись в реестр последнего калькулятора (подразумевается, что он новый и только что был записан)
 | 
			
		||||
          calculator.calculators.push(calculators[id]);
 | 
			
		||||
 | 
			
		||||
          // Запись в журнал
 | 
			
		||||
          console.log('[КАЛЬКУЛЯТОР] Инициализирован калькулятор лазерной резки');
 | 
			
		||||
          console.log(
 | 
			
		||||
            "[КАЛЬКУЛЯТОР] Инициализирован калькулятор лазерной резки",
 | 
			
		||||
          );
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return fetch('/calculator/generate/profnastil', {
 | 
			
		||||
        return await fetch("/calculator/generate/profnastil", {
 | 
			
		||||
          method: "POST",
 | 
			
		||||
          headers: { "content-type": "application/x-www-form-urlencoded" }
 | 
			
		||||
          headers: { "content-type": "application/x-www-form-urlencoded" },
 | 
			
		||||
        }).then((response) => {
 | 
			
		||||
          if (response.status === 200) {
 | 
			
		||||
            response.text().then(
 | 
			
		||||
              success => {
 | 
			
		||||
              (success) => {
 | 
			
		||||
                // Поиск последнего калькулятора
 | 
			
		||||
                let last = calculator.calculators[calculator.calculators.length - 1];
 | 
			
		||||
                const last =
 | 
			
		||||
                  calculator.calculators[calculator.calculators.length - 1];
 | 
			
		||||
 | 
			
		||||
                if (last !== undefined && last !== null) {
 | 
			
		||||
                  // Найден калькулятор
 | 
			
		||||
 | 
			
		||||
                  // Инициализация разделителя перед меню
 | 
			
		||||
                  calculator.generate.divider(last, 'afterend').then(divider => write(last, 'afterend', success));
 | 
			
		||||
                  // Инициализация разделителя перед калькулятором 
 | 
			
		||||
                  calculator.generate.divider(last, "afterend").then(
 | 
			
		||||
                    () => write(last, "afterend", success),
 | 
			
		||||
                  );
 | 
			
		||||
                } else {
 | 
			
		||||
                  // Не найден калькулятор
 | 
			
		||||
 | 
			
		||||
                  calculator.generate.divider(menu, 'beforebegin').then(
 | 
			
		||||
                    first => {
 | 
			
		||||
                  calculator.generate.divider(menu, "beforebegin").then(
 | 
			
		||||
                    () => {
 | 
			
		||||
                      // Поиск меню
 | 
			
		||||
                      let menu = document.getElementById("menu");
 | 
			
		||||
                      const menu = document.getElementById("menu");
 | 
			
		||||
 | 
			
		||||
                      if (menu !== null) {
 | 
			
		||||
                        // Найдено меню
 | 
			
		||||
 | 
			
		||||
                        // Инициализация разделителя перед меню
 | 
			
		||||
                        calculator.generate.divider(menu, 'beforebegin').then(divider => write(menu, 'beforebegin', success));
 | 
			
		||||
                        write(menu, "beforebegin", success)
 | 
			
		||||
                      } else {
 | 
			
		||||
                        // Не найдено меню
 | 
			
		||||
 | 
			
		||||
                        // Поиск результатов калькуляции
 | 
			
		||||
                        let result = document.getElementById("result");
 | 
			
		||||
                        const result = document.getElementById("result");
 | 
			
		||||
 | 
			
		||||
                        if (result !== null) {
 | 
			
		||||
                          // Найден элемент с результатами калькуляции
 | 
			
		||||
 | 
			
		||||
                          // Инициализация разделителя перед меню
 | 
			
		||||
                          calculator.generate.divider(result, 'beforebegin').then(result => write(result, 'beforebegin', success));
 | 
			
		||||
                          calculator.generate.divider(result, "beforebegin")
 | 
			
		||||
                            .then((result) =>
 | 
			
		||||
                              write(result, "beforebegin", success)
 | 
			
		||||
                            );
 | 
			
		||||
                        } else {
 | 
			
		||||
                          // Не найден элемент с результатами калькуляции
 | 
			
		||||
 | 
			
		||||
                          // Инициализация разделителя перед меню
 | 
			
		||||
                          calculator.generate.divider().then(result => write(calculator.index, 'beforeend', success));
 | 
			
		||||
                          calculator.generate.divider().then(() =>
 | 
			
		||||
                            write(calculator.index, "beforeend", success)
 | 
			
		||||
                          );
 | 
			
		||||
                        }
 | 
			
		||||
                      }
 | 
			
		||||
                    }
 | 
			
		||||
                    },
 | 
			
		||||
                  );
 | 
			
		||||
                }
 | 
			
		||||
              },
 | 
			
		||||
              error => {
 | 
			
		||||
              () => {
 | 
			
		||||
                // Запись в журнал
 | 
			
		||||
                console.log('[КАЛЬКУЛЯТОР] [ОШИБКА] Не удалось инициализировать калькулятор лазерной резки');
 | 
			
		||||
              });
 | 
			
		||||
                console.log(
 | 
			
		||||
                  "[КАЛЬКУЛЯТОР] [ОШИБКА] Не удалось инициализировать калькулятор лазерной резки",
 | 
			
		||||
                );
 | 
			
		||||
              },
 | 
			
		||||
            );
 | 
			
		||||
          }
 | 
			
		||||
        });
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,7 @@
 | 
			
		||||
  <label>Забор</label>
 | 
			
		||||
  <div>
 | 
			
		||||
    <select name="fence" data-calculator-parameter="fence" title="Тип забора">
 | 
			
		||||
      <option value="1">Сплошной</option>
 | 
			
		||||
      <option value="2">Секционный</option>
 | 
			
		||||
      <option value="1">???</option>
 | 
			
		||||
    </select>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,8 @@
 | 
			
		||||
  <label>Забор</label>
 | 
			
		||||
  <div>
 | 
			
		||||
    <select name="fence" data-calculator-parameter="fence" title="Тип забора">
 | 
			
		||||
      <option value="1">???</option>
 | 
			
		||||
      <option value="1">Сплошной</option>
 | 
			
		||||
      <option value="2">Секционный</option>
 | 
			
		||||
    </select>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,14 @@
 | 
			
		||||
<section id="menu" class="unselectable">
 | 
			
		||||
    <a type="button" onclick="calculator.generate.calculators.profnastil(); return false;">
 | 
			
		||||
        <img src="/img/laser.png" title="Расчитать профнастил">
 | 
			
		||||
        <img src="" title="Расчитать профнастил">
 | 
			
		||||
       Профнастил 
 | 
			
		||||
    </a>
 | 
			
		||||
    <a type="button" onclick="calculator.generate.calculators.setka(); return false;">
 | 
			
		||||
        <img src="" title="Расчитать 3D-сетку">
 | 
			
		||||
       3D-сетка 
 | 
			
		||||
    </a>
 | 
			
		||||
    <a type="button" onclick="calculator.generate.calculators.evroshtaket); return false;">
 | 
			
		||||
        <img src="" title="Расчитать евроштакет">
 | 
			
		||||
       Евроштакет
 | 
			
		||||
    </a>
 | 
			
		||||
</section>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,99 +1,97 @@
 | 
			
		||||
<h3>Лазерная резка <span title="Удалить"></span></h3>
 | 
			
		||||
<h3>Забор из профнастила<span title="Удалить"></span></h3>
 | 
			
		||||
<section class="calculator" data-calculator="laser">
 | 
			
		||||
     <div>
 | 
			
		||||
        <label>Тип</label>
 | 
			
		||||
        <div>
 | 
			
		||||
            <select name="type" data-calculator-parameter="type" title="Тип профнастила">
 | 
			
		||||
                <option value="c8">C8</option>
 | 
			
		||||
                <option value="c10">C10</option>
 | 
			
		||||
                <option value="hc21">HC21</option>
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
   <div>
 | 
			
		||||
        <label>Цвет каркаса</label>
 | 
			
		||||
        <div>
 | 
			
		||||
          <select name="base_color" data-calculator-parameter="base_color" title="Цвет">
 | 
			
		||||
                <option value="chocolate">Шоколад</option>
 | 
			
		||||
                <option value="graphite">Графит</option>
 | 
			
		||||
                <option value="green_moss">Зелёный мох</option>
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
   <div>
 | 
			
		||||
        <label>Каркас</label>
 | 
			
		||||
        <div>
 | 
			
		||||
          <select name="base" data-calculator-parameter="base" title="Каркас" onchange="calculator.generate.fence(this.parentElement.parentElement.parentElement, this.value)">
 | 
			
		||||
                <option value="1">Профильная труба</option>
 | 
			
		||||
                <option value="2">П-образный профиль</option>
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    {% include 'calculators/elements/fences/1.html' %}
 | 
			
		||||
 | 
			
		||||
   <div>
 | 
			
		||||
        <label>Цвет забора</label>
 | 
			
		||||
        <div>
 | 
			
		||||
          <select name="fence_color" data-calculator-parameter="fence_color" title="Цвет">
 | 
			
		||||
                <option value="chocolate">Шоколад</option>
 | 
			
		||||
                <option value="graphite">Графит</option>
 | 
			
		||||
                <option value="green_moss">Зелёный мох</option>
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
  <div>
 | 
			
		||||
    <label>Тип</label>
 | 
			
		||||
    <div>
 | 
			
		||||
        <label>Размер</label>
 | 
			
		||||
        <div>
 | 
			
		||||
            <input data-calculator-parameter="width" type="number" class="measured" title="Длина детали"
 | 
			
		||||
                value="{{ calculators.laser.width }}" min="{{ calculators.laser.width.min ?? 1 }}"
 | 
			
		||||
                max="{{ calculators.laser.width.max ?? 3000 }}">
 | 
			
		||||
            <span class="unit unselectable">мм</span>
 | 
			
		||||
            <small>x</small>
 | 
			
		||||
            <input data-calculator-parameter="height" type="number" class="measured" title="Ширина детали"
 | 
			
		||||
                value="{{ calculators.laser.height }}" min="{{ calculators.laser.height.min ?? 1 }}"
 | 
			
		||||
                max="{{ calculators.laser.height.max ?? 3000 }}">
 | 
			
		||||
            <span class="unit unselectable">мм</span>
 | 
			
		||||
            <small>x</small>
 | 
			
		||||
            <input data-calculator-parameter="length" type="number" class="measured" title="Толщина детали"
 | 
			
		||||
                value="{{ calculators.laser.length }}" min="{{ calculators.laser.length.min ?? 1 }}"
 | 
			
		||||
                max="{{ calculators.laser.length.max ?? 20 }}">
 | 
			
		||||
            <span class="unit unselectable">мм</span>
 | 
			
		||||
        </div>
 | 
			
		||||
      <select name="type" data-calculator-parameter="type" title="Выбор типа профнастила">
 | 
			
		||||
        <option value="c8">C8</option>
 | 
			
		||||
        <option value="c10">C10</option>
 | 
			
		||||
        <option value="hc21">HC21</option>
 | 
			
		||||
      </select>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div>
 | 
			
		||||
    <label>Цвет каркаса</label>
 | 
			
		||||
    <div>
 | 
			
		||||
        <label>Отверстия</label>
 | 
			
		||||
        <div>
 | 
			
		||||
            <input data-calculator-parameter="holes" type="number" class="measured" title="Количество отверстий"
 | 
			
		||||
                value="{{ calculators.laser.holes }}" min="{{ calculators.laser.holes.min ?? 0 }}"
 | 
			
		||||
                max="{{ calculators.laser.holes.max ?? 100 }}">
 | 
			
		||||
            <span class="unit unselectable">шт</span>
 | 
			
		||||
            <small>x</small>
 | 
			
		||||
            <input data-calculator-parameter="diameter" type="number" class="measured" title="Диаметр отверстий"
 | 
			
		||||
                value="{{ calculators.laser.diameter }}" min="{{ calculators.laser.diameter.min ?? 0 }}"
 | 
			
		||||
                max="{{ calculators.laser.diameter.max ?? 100 }}">
 | 
			
		||||
            <span class="unit unselectable">мм</span>
 | 
			
		||||
        </div>
 | 
			
		||||
      <select name="base_color" data-calculator-parameter="base_color" title="Выбор цвета каркаса">
 | 
			
		||||
        <option value="chocolate">Шоколад</option>
 | 
			
		||||
        <option value="graphite">Графит</option>
 | 
			
		||||
        <option value="green_moss">Зелёный мох</option>
 | 
			
		||||
      </select>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div>
 | 
			
		||||
    <label>Каркас</label>
 | 
			
		||||
    <div>
 | 
			
		||||
        <label>Количество</label>
 | 
			
		||||
        <div>
 | 
			
		||||
            <input data-calculator-parameter="amount" type="number" class="measured" title="Количество изделий"
 | 
			
		||||
                value="{{ calculators.laser.amount }}" min="{{ calculators.laser.amount.min ?? 1 }}"
 | 
			
		||||
                max="{{ calculators.laser.amount.max ?? 10000 }}">
 | 
			
		||||
            <span class="unit unselectable">шт</span>
 | 
			
		||||
        </div>
 | 
			
		||||
      <select name="base" data-calculator-parameter="base" title="Выбор каркаса" onchange="calculator.generate.fence(this.parentElement.parentElement.parentElement, this.value)">
 | 
			
		||||
        <option value="1">Профильная труба</option>
 | 
			
		||||
        <option value="2">П-образный профиль</option>
 | 
			
		||||
      </select>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  {% include 'calculators/elements/fences/1.html' %}
 | 
			
		||||
 | 
			
		||||
  <div>
 | 
			
		||||
    <label>Цвет профнастила</label>
 | 
			
		||||
    <div>
 | 
			
		||||
        <label for="our">Наш металл</label>
 | 
			
		||||
        <div>
 | 
			
		||||
            <input data-calculator-parameter="our" type="checkbox" title="Используется наш металл" checked>
 | 
			
		||||
        </div>
 | 
			
		||||
      <select name="fence_color" data-calculator-parameter="fence_color" title="Выбор цвета профнастила">
 | 
			
		||||
        <option value="chocolate">Шоколад</option>
 | 
			
		||||
        <option value="graphite">Графит</option>
 | 
			
		||||
        <option value="green_moss">Зелёный мох</option>
 | 
			
		||||
      </select>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div>
 | 
			
		||||
    <label>Тип монтажа</label>
 | 
			
		||||
    <div>
 | 
			
		||||
      <select name="mounting" data-calculator-parameter="mounting" title="Выбор типа монтажа">
 | 
			
		||||
        <option value="ground">В грунт</option>
 | 
			
		||||
        <option value="piles">На сваи/бетон</option>
 | 
			
		||||
      </select>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div>
 | 
			
		||||
    <label>Высота</label>
 | 
			
		||||
    <div>
 | 
			
		||||
      <select name="height" data-calculator-parameter="height" title="Высота">
 | 
			
		||||
        <option value="1800">1800мм</option>
 | 
			
		||||
        <option value="2000">2000мм</option>
 | 
			
		||||
      </select>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div>
 | 
			
		||||
    <label>Длина</label>
 | 
			
		||||
    <div>
 | 
			
		||||
      <input data-calculator-parameter="length" type="number" class="measured" title="Длина детали"
 | 
			
		||||
      value="{{ calculators.profnastil.length.default ?? 1 }}" min="{{ calculators.profnastil.length.min ?? 1 }}"
 | 
			
		||||
      max="{{ calculators.profnastil.length.max ?? 3000 }}">
 | 
			
		||||
      <span class="unit unselectable">м</span>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div>
 | 
			
		||||
    <label>Калитки</label>
 | 
			
		||||
    <div>
 | 
			
		||||
      <input data-calculator-parameter="wickets" type="number" class="measured" title="Количество калиток"
 | 
			
		||||
      value="{{ calculators.profnastil.wickets.default ?? 0 }}" min="{{ calculators.profnastil.wickets.min ?? 0 }}"
 | 
			
		||||
      max="{{ calculators.profnastil.wickets.max ?? 100 }}">
 | 
			
		||||
      <span class="unit unselectable">шт</span>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div>
 | 
			
		||||
    <label>Ворота</label>
 | 
			
		||||
    <div>
 | 
			
		||||
      <input data-calculator-parameter="gates" type="number" class="measured" title="Количество ворот"
 | 
			
		||||
      value="{{ calculators.profnastil.gates.default ?? 0 }}" min="{{ calculators.profnastil.gates.min ?? 0 }}"
 | 
			
		||||
      max="{{ calculators.profnastil.gates.max ?? 100 }}">
 | 
			
		||||
      <span class="unit unselectable">шт</span>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</section>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										83
									
								
								mirzaev/zkmr/calculator/system/views/calculators/setka.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								mirzaev/zkmr/calculator/system/views/calculators/setka.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,83 @@
 | 
			
		||||
<h3>Забор из профнастила<span title="Удалить"></span></h3>
 | 
			
		||||
<section class="calculator" data-calculator="laser">
 | 
			
		||||
  <div>
 | 
			
		||||
    <label>Тип</label>
 | 
			
		||||
    <div>
 | 
			
		||||
      <select name="type" data-calculator-parameter="type" title="Выбор типа сетки">
 | 
			
		||||
        <option value="light">light</option>
 | 
			
		||||
        <option value="medium">medium</option>
 | 
			
		||||
        <option value="optima">optima</option>
 | 
			
		||||
      </select>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div>
 | 
			
		||||
    <label>Цвет сетки</label>
 | 
			
		||||
    <div>
 | 
			
		||||
      <select name="fence_color" data-calculator-parameter="fence_color" title="Выбор цвета сетки">
 | 
			
		||||
        <option value="graphite">Графит</option>
 | 
			
		||||
        <option value="green_moss">Зелёный мох</option>
 | 
			
		||||
      </select>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div>
 | 
			
		||||
    <label>Тип крепления</label>
 | 
			
		||||
    <div>
 | 
			
		||||
      <select name="fastening" data-calculator-parameter="fastening" title="Выбор типа крепления">
 | 
			
		||||
        <option value="brace">Скоба</option>
 | 
			
		||||
        <option value="collar">Хомут</option>
 | 
			
		||||
      </select>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div>
 | 
			
		||||
    <label>Тип монтажа</label>
 | 
			
		||||
    <div>
 | 
			
		||||
      <select name="mounting" data-calculator-parameter="mounting" title="Выбор типа монтажа">
 | 
			
		||||
        <option value="ground">В грунт</option>
 | 
			
		||||
        <option value="piles">На сваи/бетон</option>
 | 
			
		||||
      </select>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div>
 | 
			
		||||
    <label>Высота</label>
 | 
			
		||||
    <div>
 | 
			
		||||
      <select name="height" data-calculator-parameter="height" title="Высота">
 | 
			
		||||
        <option value="1800">1800мм</option>
 | 
			
		||||
        <option value="2000">2000мм</option>
 | 
			
		||||
      </select>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div>
 | 
			
		||||
    <label>Длина</label>
 | 
			
		||||
    <div>
 | 
			
		||||
      <input data-calculator-parameter="length" type="number" class="measured" title="Длина детали"
 | 
			
		||||
      value="{{ calculators.profnastil.length.default ?? 1 }}" min="{{ calculators.profnastil.length.min ?? 1 }}"
 | 
			
		||||
      max="{{ calculators.profnastil.length.max ?? 3000 }}">
 | 
			
		||||
      <span class="unit unselectable">м</span>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div>
 | 
			
		||||
    <label>Калитки</label>
 | 
			
		||||
    <div>
 | 
			
		||||
      <input data-calculator-parameter="wickets" type="number" class="measured" title="Количество калиток"
 | 
			
		||||
      value="{{ calculators.profnastil.wickets.default ?? 0 }}" min="{{ calculators.profnastil.wickets.min ?? 0 }}"
 | 
			
		||||
      max="{{ calculators.profnastil.wickets.max ?? 100 }}">
 | 
			
		||||
      <span class="unit unselectable">шт</span>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div>
 | 
			
		||||
    <label>Ворота</label>
 | 
			
		||||
    <div>
 | 
			
		||||
      <input data-calculator-parameter="gates" type="number" class="measured" title="Количество ворот"
 | 
			
		||||
      value="{{ calculators.profnastil.gates.default ?? 0 }}" min="{{ calculators.profnastil.gates.min ?? 0 }}"
 | 
			
		||||
      max="{{ calculators.profnastil.gates.max ?? 100 }}">
 | 
			
		||||
      <span class="unit unselectable">шт</span>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</section>
 | 
			
		||||
							
								
								
									
										16
									
								
								psalm.xml
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								psalm.xml
									
									
									
									
									
								
							@@ -1,16 +0,0 @@
 | 
			
		||||
<?xml version="1.0"?>
 | 
			
		||||
<psalm
 | 
			
		||||
    errorLevel="7"
 | 
			
		||||
    resolveFromConfigFile="true"
 | 
			
		||||
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 | 
			
		||||
    xmlns="https://getpsalm.org/schema/config"
 | 
			
		||||
    xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
 | 
			
		||||
    findUnusedBaselineEntry="true"
 | 
			
		||||
>
 | 
			
		||||
    <projectFiles>
 | 
			
		||||
        <directory name="mirzaev/zkmr/calculator/system" />
 | 
			
		||||
        <ignoreFiles>
 | 
			
		||||
            <directory name="vendor" />
 | 
			
		||||
        </ignoreFiles>
 | 
			
		||||
    </projectFiles>
 | 
			
		||||
</psalm>
 | 
			
		||||
		Reference in New Issue
	
	Block a user