/
DevDenzo
/
ERP
Обзор
Документация
Войти
/
DevDenzo
/
ERP
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/tools/Trees/TreeProduction/FormEntryDataProduct.jsx
136 строк
6 KB
Denis Sklyarskij
Инициализирован репозиторий
14 янв 2026, 23:32
14 янв 2026, 23:32
1df3d47
Код
Авторство
О чём код?
import React, { memo } from "react"; import classNames from "classnames"; import { X, Check } from "react-bootstrap-icons"; // Подключаем маппинг формы производства import { formProductMapping } from "./formProductMapping.js"; // Подключаем стили формы ввода изделия import './_form-entry-product.less'; const FormEntryDataProduct = memo(({ product }) => { // Получаем ключи из массива product const keysProduct = Object.keys(product[0]); return ( <div className={classNames("container-product-form")}> <form className={classNames("form-entry-product")}> <div className={classNames("form-entry-product__header")}> <h5 className={classNames("form-entry-product__title")}> Добавить изделие </h5> <button type="button" className={classNames( "btn", "btn-light", "form-entry-product__top-button-close" )} > <X size={18} /> </button> </div> <div className={classNames("form-entry-data__body")}> {keysProduct.map((item, index) => { if (item === "id" || item === "slug") return null; if (item === "priorityOrder") { return ( <div key={index} className={classNames( "input-group mb-3", "product-form-group" )} > <label className={classNames( "form-label", "product-form-group__label" )} > { formProductMapping[item] } </label> <div className={classNames( "form-check", "product-form-group__check" )} > <input type="checkbox" className={classNames( "form-check-input", "product-form-group__check-input" )} /> <label className={classNames( "form-check-label", "product-form-group__check-out" )} > <Check size={18} /> </label> </div> </div> ); } else { return ( <div key={index} className={classNames( "input-group mb-3", "product-form-group" )} > <label className={classNames( "form-label", "product-form-group__label" )} > { formProductMapping[item] } </label> <input type={(item === 'quantity') ? "number" : "text"} className={classNames( "form-control", "product-form-group__input" )} /> </div> ); } })} </div> <div className={classNames("form-entry-product__footer")}> <button type="button" className={classNames( "btn", "btn-light", "form-entry-product__button-cancel" )} > Отмена </button> <button type="button" className={classNames( "btn", "btn-light", "form-entry-product__button-submit" )} > Отправить </button> </div> </form> </div> ); }); export default FormEntryDataProduct;