Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
E
ecouniversal
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Babin Egor
ecouniversal
Commits
77513f67
Commit
77513f67
authored
Feb 11, 2020
by
Babin Egor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update forms
parent
94a93930
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
480 additions
and
18 deletions
+480
-18
app-registration-form.js
src/blocks/app-registration-form/app-registration-form.js
+478
-16
index.pug
src/pages/index.pug
+2
-2
No files found.
src/blocks/app-registration-form/app-registration-form.js
View file @
77513f67
...
...
@@ -37,7 +37,9 @@ Vue.component('app-registration-form', {
companyChiefActingUnder
:
''
,
companyContactPost
:
''
,
companyContactFullname
:
''
,
companyContactSecondName
:
''
,
companyContactFirstName
:
''
,
companyContactLastName
:
''
,
companyContactEmail
:
''
,
companyContactPhone
:
''
,
...
...
@@ -82,9 +84,81 @@ Vue.component('app-registration-form', {
firstStage
()
{
return
this
.
currentStage
===
0
},
lastestStage
()
{
if
(
this
.
currentPT
==
"juridical"
)
{
return
this
.
currentStage
===
2
}
else
if
(
this
.
currentPT
==
"natural"
)
{
return
this
.
currentStage
===
1
}
},
lastStage
()
{
return
this
.
currentStage
>=
this
.
stages
[
this
.
currentPT
].
length
-
1
},
nextpage
()
{
if
(
this
.
currentPT
==
"juridical"
)
{
if
(
this
.
currentStage
==
0
)
{
if
(
(
this
.
validateInn
(
this
.
fieldsVal
.
juridical
.
companyInn
))
&&
(
this
.
validateKpp
(
this
.
fieldsVal
.
juridical
.
companyKpp
))
&&
(
this
.
fieldsVal
.
juridical
.
companyJurAddress
!==
""
)
)
{
return
false
;
}
}
else
if
(
this
.
currentStage
==
1
)
{
if
(
(
this
.
valdateName
(
this
.
fieldsVal
.
juridical
.
companyChiefFullname
))
&&
(
this
.
valdateName
(
this
.
fieldsVal
.
juridical
.
companyChiefActingUnder
))
&&
(
this
.
valdateName
(
this
.
fieldsVal
.
juridical
.
companyContactSecondName
))
&&
(
this
.
valdateName
(
this
.
fieldsVal
.
juridical
.
companyContactFirstName
))
&&
(
this
.
valdateName
(
this
.
fieldsVal
.
juridical
.
companyContactLastName
))
&&
(
this
.
valdateMail
(
this
.
fieldsVal
.
juridical
.
companyContactEmail
))
&&
(
this
.
valdatePhone
(
this
.
fieldsVal
.
juridical
.
companyContactPhone
))
)
{
return
false
;
}
}
}
else
if
(
this
.
currentPT
==
"natural"
)
{
if
(
this
.
currentStage
==
0
)
{
if
(
(
this
.
valdateName
(
this
.
fieldsVal
.
natural
.
personInfoLastname
))
&&
(
this
.
valdateName
(
this
.
fieldsVal
.
natural
.
personInfoFirstname
))
&&
(
this
.
valdateName
(
this
.
fieldsVal
.
natural
.
personInfoPatronymic
))
&&
(
this
.
valdateMail
(
this
.
fieldsVal
.
natural
.
personInfoEmail
))
&&
(
this
.
valdatePhone
(
this
.
fieldsVal
.
natural
.
personInfoPhone
))
&&
(
this
.
valdatePassSer
(
this
.
fieldsVal
.
natural
.
personPassportSeries
))
&&
(
this
.
valdatePassNum
(
this
.
fieldsVal
.
natural
.
personPassportNumber
))
&&
(
this
.
valdateName
(
this
.
fieldsVal
.
natural
.
personPassportIssuedBy
))
&&
(
this
.
valdatePassDate
(
this
.
fieldsVal
.
natural
.
personPassportIssuedDate
))
&&
(
this
.
valdateName
(
this
.
fieldsVal
.
natural
.
personPassportDepartmentCode
))
)
{
return
false
;
}
}
else
if
(
this
.
currentStage
==
1
)
{
if
(
(
this
.
valdateLogin
(
this
.
fieldsVal
.
natural
.
personAuthLogin
))
&&
(
this
.
valdatePass
(
this
.
fieldsVal
.
natural
.
personAuthPass
,
this
.
fieldsVal
.
natural
.
personAuthPassRepeat
))
)
{
return
false
;
}
}
}
return
true
;
},
formFilledRight
()
{
if
(((
this
.
fieldsVal
.
juridical
.
companyInn
!==
""
)
&&
(
this
.
fieldsVal
.
juridical
.
companyKpp
!==
""
)
&&
...
...
@@ -152,11 +226,370 @@ Vue.component('app-registration-form', {
//window.location.href = "/customers/";
}
})
},
validateBik
(
bik
,
error
)
{
var
result
=
false
;
if
(
typeof
bik
===
'number'
)
{
bik
=
bik
.
toString
();
}
else
if
(
typeof
bik
!==
'string'
)
{
bik
=
''
;
}
if
(
!
bik
.
length
)
{
error
.
code
=
1
;
error
.
message
=
'БИК пуст'
;
}
else
if
(
/
[^
0-9
]
/
.
test
(
bik
))
{
error
.
code
=
2
;
error
.
message
=
'БИК может состоять только из цифр'
;
}
else
if
(
bik
.
length
!==
9
)
{
error
.
code
=
3
;
error
.
message
=
'БИК может состоять только из 9 цифр'
;
}
else
{
result
=
true
;
}
return
result
;
},
validateInn
(
inn
)
{
var
result
=
false
;
if
(
typeof
inn
===
'number'
)
{
inn
=
inn
.
toString
();
}
else
if
(
typeof
inn
!==
'string'
)
{
inn
=
''
;
}
if
(
!
inn
.
length
)
{
// ИНН пуст
return
false
;
}
else
if
(
/
[^
0-9
]
/
.
test
(
inn
))
{
// ИНН может состоять только из цифр
return
false
;
}
else
if
([
10
,
12
].
indexOf
(
inn
.
length
)
===
-
1
)
{
// ИНН может состоять только из 10 или 12 цифр
return
false
;
}
else
{
var
checkDigit
=
function
(
inn
,
coefficients
)
{
var
n
=
0
;
for
(
var
i
in
coefficients
)
{
n
+=
coefficients
[
i
]
*
inn
[
i
];
}
return
parseInt
(
n
%
11
%
10
);
};
switch
(
inn
.
length
)
{
case
10
:
var
n10
=
checkDigit
(
inn
,
[
2
,
4
,
10
,
3
,
5
,
9
,
4
,
6
,
8
]);
if
(
n10
===
parseInt
(
inn
[
9
]))
{
result
=
true
;
}
break
;
case
12
:
var
n11
=
checkDigit
(
inn
,
[
7
,
2
,
4
,
10
,
3
,
5
,
9
,
4
,
6
,
8
]);
var
n12
=
checkDigit
(
inn
,
[
3
,
7
,
2
,
4
,
10
,
3
,
5
,
9
,
4
,
6
,
8
]);
if
((
n11
===
parseInt
(
inn
[
10
]))
&&
(
n12
===
parseInt
(
inn
[
11
])))
{
result
=
true
;
}
break
;
}
}
return
result
;
},
validateKpp
(
kpp
)
{
var
result
=
false
;
if
(
typeof
kpp
===
'number'
)
{
kpp
=
kpp
.
toString
();
}
else
if
(
typeof
kpp
!==
'string'
)
{
kpp
=
''
;
}
if
(
!
kpp
.
length
)
{
// кпп пуст
return
false
;
}
else
if
(
kpp
.
length
!==
9
)
{
// КПП может состоять только из 9 знаков (цифр или заглавных букв латинского алфавита от A до Z)
return
false
;
}
else
if
(
!
/^
[
0-9
]{4}[
0-9A-Z
]{2}[
0-9
]{3}
$/
.
test
(
kpp
))
{
// Неправильный формат КПП
return
false
;
}
else
{
result
=
true
;
}
return
result
;
},
validateKs
(
ks
,
bik
,
error
)
{
var
result
=
false
;
if
(
validateBik
(
bik
,
error
))
{
if
(
typeof
ks
===
'number'
)
{
ks
=
ks
.
toString
();
}
else
if
(
typeof
ks
!==
'string'
)
{
ks
=
''
;
}
if
(
!
ks
.
length
)
{
error
.
code
=
1
;
error
.
message
=
'К/С пуст'
;
}
else
if
(
/
[^
0-9
]
/
.
test
(
ks
))
{
error
.
code
=
2
;
error
.
message
=
'К/С может состоять только из цифр'
;
}
else
if
(
ks
.
length
!==
20
)
{
error
.
code
=
3
;
error
.
message
=
'К/С может состоять только из 20 цифр'
;
}
else
{
var
bikKs
=
'0'
+
bik
.
toString
().
slice
(
4
,
6
)
+
ks
;
var
checksum
=
0
;
var
coefficients
=
[
7
,
1
,
3
,
7
,
1
,
3
,
7
,
1
,
3
,
7
,
1
,
3
,
7
,
1
,
3
,
7
,
1
,
3
,
7
,
1
,
3
,
7
,
1
];
for
(
var
i
in
coefficients
)
{
checksum
+=
coefficients
[
i
]
*
(
bikKs
[
i
]
%
10
);
}
if
(
checksum
%
10
===
0
)
{
result
=
true
;
}
else
{
error
.
code
=
4
;
error
.
message
=
'Неправильное контрольное число'
;
}
}
}
return
result
;
},
validateOgrn
(
ogrn
,
error
)
{
var
result
=
false
;
if
(
typeof
ogrn
===
'number'
)
{
ogrn
=
ogrn
.
toString
();
}
else
if
(
typeof
ogrn
!==
'string'
)
{
ogrn
=
''
;
}
if
(
!
ogrn
.
length
)
{
error
.
code
=
1
;
error
.
message
=
'ОГРН пуст'
;
}
else
if
(
/
[^
0-9
]
/
.
test
(
ogrn
))
{
error
.
code
=
2
;
error
.
message
=
'ОГРН может состоять только из цифр'
;
}
else
if
(
ogrn
.
length
!==
13
)
{
error
.
code
=
3
;
error
.
message
=
'ОГРН может состоять только из 13 цифр'
;
}
else
{
var
n13
=
parseInt
((
parseInt
(
ogrn
.
slice
(
0
,
-
1
))
%
11
).
toString
().
slice
(
-
1
));
if
(
n13
===
parseInt
(
ogrn
[
12
]))
{
result
=
true
;
}
else
{
error
.
code
=
4
;
error
.
message
=
'Неправильное контрольное число'
;
}
}
return
result
;
},
validateOgrnip
(
ogrnip
,
error
)
{
var
result
=
false
;
if
(
typeof
ogrnip
===
'number'
)
{
ogrnip
=
ogrnip
.
toString
();
}
else
if
(
typeof
ogrnip
!==
'string'
)
{
ogrnip
=
''
;
}
if
(
!
ogrnip
.
length
)
{
error
.
code
=
1
;
error
.
message
=
'ОГРНИП пуст'
;
}
else
if
(
/
[^
0-9
]
/
.
test
(
ogrnip
))
{
error
.
code
=
2
;
error
.
message
=
'ОГРНИП может состоять только из цифр'
;
}
else
if
(
ogrnip
.
length
!==
15
)
{
error
.
code
=
3
;
error
.
message
=
'ОГРНИП может состоять только из 15 цифр'
;
}
else
{
var
n15
=
parseInt
((
parseInt
(
ogrnip
.
slice
(
0
,
-
1
))
%
13
).
toString
().
slice
(
-
1
));
if
(
n15
===
parseInt
(
ogrnip
[
14
]))
{
result
=
true
;
}
else
{
error
.
code
=
4
;
error
.
message
=
'Неправильное контрольное число'
;
}
}
return
result
;
},
validateRs
(
rs
,
bik
,
error
)
{
var
result
=
false
;
if
(
validateBik
(
bik
,
error
))
{
if
(
typeof
rs
===
'number'
)
{
rs
=
rs
.
toString
();
}
else
if
(
typeof
rs
!==
'string'
)
{
rs
=
''
;
}
if
(
!
rs
.
length
)
{
error
.
code
=
1
;
error
.
message
=
'Р/С пуст'
;
}
else
if
(
/
[^
0-9
]
/
.
test
(
rs
))
{
error
.
code
=
2
;
error
.
message
=
'Р/С может состоять только из цифр'
;
}
else
if
(
rs
.
length
!==
20
)
{
error
.
code
=
3
;
error
.
message
=
'Р/С может состоять только из 20 цифр'
;
}
else
{
var
bikRs
=
bik
.
toString
().
slice
(
-
3
)
+
rs
;
var
checksum
=
0
;
var
coefficients
=
[
7
,
1
,
3
,
7
,
1
,
3
,
7
,
1
,
3
,
7
,
1
,
3
,
7
,
1
,
3
,
7
,
1
,
3
,
7
,
1
,
3
,
7
,
1
];
for
(
var
i
in
coefficients
)
{
checksum
+=
coefficients
[
i
]
*
(
bikRs
[
i
]
%
10
);
}
if
(
checksum
%
10
===
0
)
{
result
=
true
;
}
else
{
error
.
code
=
4
;
error
.
message
=
'Неправильное контрольное число'
;
}
}
}
return
result
;
},
validateSnils
(
snils
,
error
)
{
var
result
=
false
;
if
(
typeof
snils
===
'number'
)
{
snils
=
snils
.
toString
();
}
else
if
(
typeof
snils
!==
'string'
)
{
snils
=
''
;
}
if
(
!
snils
.
length
)
{
error
.
code
=
1
;
error
.
message
=
'СНИЛС пуст'
;
}
else
if
(
/
[^
0-9
]
/
.
test
(
snils
))
{
error
.
code
=
2
;
error
.
message
=
'СНИЛС может состоять только из цифр'
;
}
else
if
(
snils
.
length
!==
11
)
{
error
.
code
=
3
;
error
.
message
=
'СНИЛС может состоять только из 11 цифр'
;
}
else
{
var
sum
=
0
;
for
(
var
i
=
0
;
i
<
9
;
i
++
)
{
sum
+=
parseInt
(
snils
[
i
])
*
(
9
-
i
);
}
var
checkDigit
=
0
;
if
(
sum
<
100
)
{
checkDigit
=
sum
;
}
else
if
(
sum
>
101
)
{
checkDigit
=
parseInt
(
sum
%
101
);
if
(
checkDigit
===
100
)
{
checkDigit
=
0
;
}
}
if
(
checkDigit
===
parseInt
(
snils
.
slice
(
-
2
)))
{
result
=
true
;
}
else
{
error
.
code
=
4
;
error
.
message
=
'Неправильное контрольное число'
;
}
}
return
result
;
},
valdateName
(
name
)
{
name
=
name
.
replace
(
/
[^
a-zA-Z0-9
]
/g
,
''
)
if
(
name
.
length
>=
2
)
{
return
true
;
}
return
false
;
},
valdateMail
(
mail
)
{
var
re
=
/^
[\w
-
\.]
+@
[\w
-
]
+
\.[
a-z
]{2,4}
$/i
;
var
valid
=
re
.
test
(
mail
);
return
valid
;
},
valdatePhone
(
phone
)
{
var
re
=
/^
\d[\d\(\)\
-
]{7,14}\d
$/
;
var
valid
=
re
.
test
(
phone
);
return
valid
;
},
valdatePassSer
(
ser
)
{
ser
=
ser
.
replace
(
/
[^
0-9
]
/g
,
''
);
if
(
ser
.
length
>=
4
)
{
return
true
;
}
else
{
return
false
;
}
},
valdatePassNum
(
num
)
{
num
=
num
.
replace
(
/
[^
0-9
]
/g
,
''
);
if
(
num
.
length
>=
6
)
{
return
true
;
}
else
{
return
false
;
}
},
valdatePassDate
(
date
)
{
date
=
date
.
replace
(
/
[^
0-9
]
/g
,
''
);
if
(
date
.
length
>=
6
)
{
return
true
;
}
else
{
return
false
;
}
},
valdateLogin
(
login
)
{
var
reg
=
/^
[
a-zA-Z0-9
]
+$/
;
if
(
!
reg
.
test
(
login
))
{
return
false
;
}
if
(
login
.
length
>=
3
)
{
return
true
;
}
else
{
return
false
;
}
},
valdatePass
(
pas
,
confpass
)
{
if
((
pas
.
length
>=
6
)
&&
(
confpass
.
length
>=
6
)
&&
(
pas
===
confpass
))
{
return
true
;
}
else
{
return
false
;
}
},
},
template
:
`
<div>
<!-- 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;">
{{ fieldsVal[currentPT] }}
</div>
<div style="display: block; position: fixed; left: 0;top: 0%; background-color:#fff; z-index:1000; width: 300px; padding: 10px; border: 1px solid #999;">
<pre>
{{ localRecord }}<br><br>
{{ wUnitAmounts }}
{{currentStage}}
</pre>
</div>
<!-- end Debug --->
<!-- Stages -->
<div class="order-registration__stages">
...
...
@@ -416,12 +849,38 @@ Vue.component('app-registration-form', {
<div class="block_orange-b">
<label class="field-text">
<span class="field-text__name">Ф
ИО
<span style="color: red;">*</span></span>
<span class="field-text__name">Ф
амилия
<span style="color: red;">*</span></span>
<span class="field-text__input-wrap">
<input type="text"
placeholder="ФИО"
placeholder="Фамилия"
class="field-text__input"
v-model="fieldsVal.juridical.companyContactSecondName"
>
</span>
</label>
</div>
<div class="block_orange-b">
<label class="field-text">
<span class="field-text__name">Имя<span style="color: red;">*</span></span>
<span class="field-text__input-wrap">
<input type="text"
placeholder="Имя"
class="field-text__input"
v-model="fieldsVal.juridical.companyContactFirstName"
>
</span>
</label>
</div>
<div class="block_orange-b">
<label class="field-text">
<span class="field-text__name">Отчество<span style="color: red;">*</span></span>
<span class="field-text__input-wrap">
<input type="text"
placeholder="Отчество"
class="field-text__input"
v-model="fieldsVal.juridical.companyContact
Fulln
ame"
v-model="fieldsVal.juridical.companyContact
LastN
ame"
>
</span>
</label>
...
...
@@ -602,7 +1061,7 @@ Vue.component('app-registration-form', {
<div class="block_orange-b">
<label class="field-text">
<span class="field-text__name">Серия</span>
<span class="field-text__name">Серия
<span style="color: red;">*</span>
</span>
<span class="field-text__input-wrap">
<input type="text"
placeholder="Серия"
...
...
@@ -758,7 +1217,8 @@ Vue.component('app-registration-form', {
<label class="field-text">
<span class="field-text__name">Пароль <span style="color: red;">*</span></span>
<span class="field-text__input-wrap">
<input type="newpassword"
<input type="password"
placeholder="Пароль"
class="field-text__input"
v-model="fieldsVal.natural.personAuthPass"
...
...
@@ -770,7 +1230,7 @@ Vue.component('app-registration-form', {
<label class="field-text">
<span class="field-text__name">Повторите пароль <span style="color: red;">*</span></span>
<span class="field-text__input-wrap">
<input type="
new
password"
<input type="password"
placeholder="Повторите пароль"
class="field-text__input"
v-model="fieldsVal.natural.personAuthPassRepeat"
...
...
@@ -811,16 +1271,18 @@ Vue.component('app-registration-form', {
:disabled="!formFilledRight"
>Зарегистрироваться</button>
<div>
<button type="button"
class="btn btn_primary"
@click="nextStage"
v-if="(!lastStage)
"
:disabled="nextpage
"
>Далее</button>
</div>
</div>
</div>
</form>
</div>
...
...
src/pages/index.pug
View file @
77513f67
...
...
@@ -20,7 +20,7 @@ block page
h1.title!=title
<app-registration></app-registration>
app-registration
br
br
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment