-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/extract meta data from sale receipt #65
Conversation
var traderCodeCheckbox = document.getElementById('trader_code_not_available_checkbox_' + resourcePk); | ||
|
||
if (!/^\d{10}$/.test(ownerMobileNumberInput.value) && !ownerMobileNumberCheckbox.checked && !ownerMobileNumberInput.disabled) { | ||
alert('please enter valid number'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alert('please enter valid number'); | |
alert('Please enter a valid mobile number.'); |
} | ||
|
||
if (!/^\d+$/.test(traderCodeInput.value) && !traderCodeCheckbox.checked && !traderCodeInput.disabled) { | ||
alert('please enter valid trader code'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alert('please enter valid trader code'); | |
alert('Please enter a valid trader code.'); |
admin/views.py
Outdated
@@ -1222,6 +1236,14 @@ def update_receipt_status(): | |||
return response | |||
|
|||
|
|||
@admin.route("/update_receipt_data", methods=["POST"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use hyphens in the routes.
} | ||
|
||
|
||
function handleTraderCodeInput(traderCode, resourcePk) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function handleTraderCodeInput(traderCode, resourcePk) { | |
function handleTraderCodeInput(traderCode, resourcePk) { |
.then(response => response.json()) | ||
.then(data => { | ||
if (data.success) { | ||
if (data.message === "please provide receipt owner mobile number") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't seem like a very reliable way to check for validation. Any small change to this big message will lead to a failure. I would suggest you either use data.success or send another parameter that is short and slugified.
{% endfor %} | ||
]; | ||
|
||
function toggleMobileNumberInput(checked, resourcePk) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toggle is not a correct representation of the action. Toggle is for checkbox on/off toggle. This should be named like:
function toggleMobileNumberInput(checked, resourcePk) { | |
function onChangeMobileNumberInput(checked, resourcePk) { |
} | ||
} | ||
|
||
function toggleTraderCodeInput(checked, resourcePk) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function toggleTraderCodeInput(checked, resourcePk) { | |
function onChangeTraderCodeInput(checked, resourcePk) { |
https://gramhal.monday.com/boards/4834273983/pulses/6417088008