Commit 0d41a138 authored by Babin Egor's avatar Babin Egor

update form

parent 86ea9230
......@@ -31,7 +31,7 @@ Vue.component('app-registration-form', {
settings: {
searchEnabled: true,
shouldSort: false,
noChoicesText: 'Пусто',
noChoicesText: 'Пусто',
noResultsText: 'Ничего не найдено',
},
helptext: ''
......@@ -86,6 +86,10 @@ Vue.component('app-registration-form', {
companyAuthLogin: '',
companyAuthPass: '',
companyAuthPassRepeat: '',
companyTrans: '',
companyGovNum: '',
companyTransportCostPerKm: '',
},
natural: {
personInfoLastname: '',
......@@ -111,6 +115,10 @@ Vue.component('app-registration-form', {
personAuthLogin: '',
personAuthPass: '',
personAuthPassRepeat: '',
personTrans: '',
personGovNum: '',
personTransportCostPerKm: '',
}
},
currentPT: this.personType, //текущий тип клиента
......@@ -182,7 +190,7 @@ Vue.component('app-registration-form', {
return false;
}
}
}
} else if (this.currentPT == "natural") {
if (this.currentStage == 0) {
......@@ -225,13 +233,25 @@ Vue.component('app-registration-form', {
(this.valdateName(this.fieldsVal.juridical.companyContactLastName)) &&
(this.valdateMail(this.fieldsVal.juridical.companyContactEmail)) &&
(this.valdatePhone(this.fieldsVal.juridical.companyContactPhone)) &&
(this.valdateLogin(this.fieldsVal.juridical.companyAuthLogin)) &&
(this.valdatePass(this.fieldsVal.juridical.companyAuthPass, this.fieldsVal.juridical.companyAuthPassRepeat))
(this.valdatePhone(this.fieldsVal.juridical.companyContactPhone))
) {
return true;
if (this.personRegType !== "executor") {
if (
(this.valdateLogin(this.fieldsVal.juridical.companyAuthLogin)) &&
(this.valdatePass(this.fieldsVal.juridical.companyAuthPass, this.fieldsVal.juridical.companyAuthPassRepeat))) {
return true;
}
} else {
if (
(this.valdateName(this.fieldsVal.juridical.companyTrans)) &&
(this.valdateName(this.fieldsVal.juridical.companyGovNum)) &&
(this.localRecord.wAddress.region.name !== '') &&
(this.valdateName(this.fieldsVal.juridical.companyTransportCostPerKm))
) {
return true;
}
}
}
} else if (this.currentPT == "natural") {
......@@ -248,13 +268,28 @@ Vue.component('app-registration-form', {
(this.valdatePassNum(this.fieldsVal.natural.personPassportNumber)) &&
(this.valdateName(this.fieldsVal.natural.personPassportIssuedBy)) &&
(this.valdatePassDate(this.fieldsVal.natural.personPassportIssuedDate)) &&
(this.valdateName(this.fieldsVal.natural.personPassportDepartmentCode)) &&
(this.valdateLogin(this.fieldsVal.natural.personAuthLogin)) &&
(this.valdatePass(this.fieldsVal.natural.personAuthPass, this.fieldsVal.natural.personAuthPassRepeat))
(this.valdateName(this.fieldsVal.natural.personPassportDepartmentCode)) || 1
) {
return true;
if (this.personRegType !== "executor") {
if (
(this.valdateLogin(this.fieldsVal.natural.personAuthLogin)) &&
(this.valdatePass(this.fieldsVal.natural.personAuthPass, this.fieldsVal.natural.personAuthPassRepeat))
) {
return true;
}
} else {
if (
//(this.localRecord.wGroup != {}) &&
(this.valdateName(this.fieldsVal.natural.personTrans)) &&
(this.valdateName(this.fieldsVal.natural.personGovNum)) &&
(this.localRecord.wAddress.region.name !== '') &&
(this.valdateName(this.fieldsVal.natural.personTransportCostPerKm)) //&&
//(this.wUnitAmounts != [{}])
) {
return true;
}
}
}
}
......@@ -282,10 +317,10 @@ Vue.component('app-registration-form', {
this.transportUnitsLoad();
},
addUnit(index){
alert(this.wUnitsSelect.options.length);
//alert(this.wUnitsSelect.options.length);
this.wUnitAmounts.push({});
},
test3(index,e){
addСapacity(index,e){
this.wUnitAmounts[index].value = e.value;
this.wUnitAmounts[index].label = e.caption;
//alert(JSON.stringify(e));
......@@ -309,7 +344,7 @@ Vue.component('app-registration-form', {
},
transportUnitsLoad(){
axios
.get(this.transportUnitsUrl())
.get(this.transportUnitsUrl(this.localRecord.wGroup.value))
.then(response => response.data)
.then(options => {
this.$set(this.wUnitsSelect, 'options', options);
......@@ -371,6 +406,8 @@ Vue.component('app-registration-form', {
return "Добавить заказчика"
} else if (this.personRegTypeProp == "executor") {
return "Добавить исполнителя"
} else if (this.personRegTypeProp == "neworder") {
return "Оформить заказ"
}
},
......@@ -396,11 +433,13 @@ Vue.component('app-registration-form', {
},
sendform() {
let post_data = this.fieldsVal[this.currentPT];
if (this.formFilledRight) {
$.ajax({
url: "form.php",
data: {
"date": this.fieldsVal[this.currentPT],
"date": post_data,
},
dataType: "html",
type: "post",
......@@ -775,10 +814,14 @@ Vue.component('app-registration-form', {
<!-- Debug --->
<!--
<div style="display: block; position: fixed; right: 0;top: 0%; background-color:#fff; z-index:1000; width: 300px; padding: 10px; border: 1px solid #999;">
{{ buttonRegTxt }}
<pre>
{{ fieldsVal[currentPT] }}
</pre>
</div>
-->
<!-- end Debug --->
<!-- Stages -->
......@@ -1140,7 +1183,7 @@ Vue.component('app-registration-form', {
<input type="text"
placeholder="Транспорт"
class="field-text__input"
v-model="fieldsVal.juridical.companyContactPhone"
v-model="fieldsVal.juridical.companyTrans"
>
</span>
</label>
......@@ -1155,7 +1198,7 @@ Vue.component('app-registration-form', {
<input type="text"
placeholder="Гос. номер"
class="field-text__input"
v-model="fieldsVal.juridical.companyContactPhone"
v-model="fieldsVal.juridical.companyGovNum"
>
</span>
</label>
......@@ -1255,7 +1298,7 @@ Vue.component('app-registration-form', {
<field-select
v-bind="wUnitsSelect"
:init="unitItem"
@change="test3(index,$event)"
@change="addСapacity(index,$event)"
>
</field-select>
</span>
......@@ -1263,7 +1306,7 @@ Vue.component('app-registration-form', {
</div>
<div class="add-btn"
v-if="((index === wUnitAmounts.length-1) && (index < (wUnitsSelect.options.length - 1)))">
v-if="((index === wUnitAmounts.length-1) && (index < (wUnitsSelect.options.length - 2)))">
<a class="btn btn_secondary btn_icon"
href="javascript:void(0);"
@click="addUnit(index)">
......@@ -1590,7 +1633,7 @@ Vue.component('app-registration-form', {
<input type="text"
placeholder="Транспорт"
class="field-text__input"
v-model="fieldsVal.juridical.companyContactPhone"
v-model="fieldsVal.natural.personTrans"
>
</span>
</label>
......@@ -1605,7 +1648,7 @@ Vue.component('app-registration-form', {
<input type="text"
placeholder="Гос. номер"
class="field-text__input"
v-model="fieldsVal.juridical.companyContactPhone"
v-model="fieldsVal.natural.personGovNum"
>
</span>
</label>
......@@ -1617,7 +1660,7 @@ Vue.component('app-registration-form', {
<textarea class="field-text__input"
name="comment"
placeholder="Комментарий"
v-model="fieldsVal.juridical.companyExtraComment"
v-model="fieldsVal.natural.personExtraComment"
></textarea>
</span>
</label>
......@@ -1663,7 +1706,7 @@ Vue.component('app-registration-form', {
<input type="text"
placeholder="Стоимость транспортировки"
class="field-text__input"
v-model="fieldsVal.juridical.companyContactPhone"
v-model="fieldsVal.natural.personTransportCostPerKm"
>
</span>
</label>
......@@ -1705,7 +1748,7 @@ Vue.component('app-registration-form', {
<field-select
v-bind="wUnitsSelect"
:init="unitItem"
@change="test3(index,$event)"
@change="addСapacity(index,$event)"
>
</field-select>
</span>
......@@ -1713,7 +1756,7 @@ Vue.component('app-registration-form', {
</div>
<div class="add-btn"
v-if="(index < (wUnitsSelect.options.length - 2))">
v-if="((index === wUnitAmounts.length-1) && (index < (wUnitsSelect.options.length - 2)))">
<a class="btn btn_secondary btn_icon"
href="javascript:void(0);"
@click="addUnit(index)">
......
......@@ -527,13 +527,16 @@ Vue.component('app-waste-utilisation-order-form', {
>
</waste-filter>
</div>
<!-- Debug --->
<!--
<div class="debug"
style="position: absolute; right: -270px;top: 500px; background-color:#fff; z-index:1000; width: 400px; height: 1000px; padding: 10px; border: 1px solid #999;">
<pre>
{{ localRecord }}
</pre>
</div>
-->
<!-- end Debug --->
<!-- Form -->
......
......@@ -20,7 +20,7 @@ block page
h1.title!=title
app-registration(:reg_info_from="'executor'")
app-registration(:reg_info_from="'neworder'")
br
br
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment