diff --git a/app/components/shops/edit-shop/edit-shop.component.js b/app/components/shops/edit-shop/edit-shop.component.js index 59e1dc6..fe03c09 100644 --- a/app/components/shops/edit-shop/edit-shop.component.js +++ b/app/components/shops/edit-shop/edit-shop.component.js @@ -42,35 +42,16 @@ shops.component('editShop', { if (form.category.$dirty) { args.categoryRef = form.category.$modelValue; } - if (form.shopDetailsName.$dirty) { - if (!args.shopDetails) { - args.shopDetails = {}; - } + if (form.shopDetailsName.$dirty || form.shopDetailsDescription.$dirty || form.shopDetailsLocation.$dirty) { + args.shopDetails = {}; args.shopDetails.name = form.shopDetailsName.$modelValue; - } - if (form.shopDetailsDescription.$dirty) { - if (!args.shopDetails) { - args.shopDetails = {}; - } args.shopDetails.description = form.shopDetailsDescription.$modelValue; - } - if (form.shopDetailsLocation.$dirty) { - if (!args.shopDetails) { - args.shopDetails = {}; - } args.shopDetails.location = form.shopDetailsLocation.$modelValue; } if (form.contractorRegisteredName.$dirty) { - if (!args.contractor) { - args.contractor = {}; - } + args.contractor = {}; args.contractor.registeredName = form.contractorRegisteredName.$modelValue; - } - if (form.contractorLegalEntity.$dirty) { - if (!args.contractor) { - args.contractor = {}; - } - args.contractor.legalEntity = form.contractorLegalEntity.$modelValue; + args.contractor.legalEntity = ''; } return args; } diff --git a/app/components/shops/edit-shop/edit-shop.template.pug b/app/components/shops/edit-shop/edit-shop.template.pug index 3c9eeed..c722553 100644 --- a/app/components/shops/edit-shop/edit-shop.template.pug +++ b/app/components/shops/edit-shop/edit-shop.template.pug @@ -8,9 +8,9 @@ form.form-horizontal.form-label-left.css-form(novalidate name="form") .form-group - label.control-label.col-md-3 Название магазина * + label.control-label.col-md-3 Название магазина .col-md-6 - input.form-control(type="text" ng-model="$ctrl.shopDetails.name" name="shopDetailsName" required) + input.form-control(type="text" ng-model="$ctrl.shopDetails.name" name="shopDetailsName") .form-group label.control-label.col-md-3 Описание магазина .col-md-6 @@ -21,18 +21,18 @@ input.form-control(type="text" ng-model="$ctrl.shopDetails.location" name="shopDetailsLocation") .form-group - label.control-label.col-md-3 Наименование организации * + label.control-label.col-md-3 Наименование организации .col-md-6 - input.form-control(type="text" ng-model="$ctrl.contractor.registeredName" name="contractorRegisteredName" required) + input.form-control(type="text" ng-model="$ctrl.contractor.registeredName" name="contractorRegisteredName") //.form-group // label.control-label.col-md-3 Тип юридического лица // .col-md-6 // input.form-control(type="text" ng-model="$ctrl.contractor.legalEntity" name="contractorLegalEntity") .form-group - label.control-label.col-md-3 Категория * + label.control-label.col-md-3 Категория .col-md-6 - select.select2_multiple.form-control.custom_select(select2 ng-model="$ctrl.categoryRef" required name="category" + select.select2_multiple.form-control.custom_select(select2 ng-model="$ctrl.categoryRef" name="category" ng-options="category.categoryRef as category.name for category in $ctrl.categories") .ln_solid .form-group