Skip to content

Commit

Permalink
fix: recipient document maxLength (#322)
Browse files Browse the repository at this point in the history
fix: recipient document maxLength
  • Loading branch information
RafaMelazzo authored Mar 27, 2024
2 parents 5eaf3a7 + cc1e1e7 commit f999d0f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Recipients/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function execute()

$resultPage = $this->resultPageFactory->create();

$title = $recipientId ? __('Edit Recipient') : __('Create Recipient');
$title = $recipientId ? __('Recipient') : __('Create Recipient');

$resultPage->getConfig()->getTitle()->prepend($title);

Expand Down
1 change: 1 addition & 0 deletions i18n/pt_BR.csv
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@
"Weekly","Semanalmente"
"Monthly","Mensalmente"
"Create Recipient","Criar Recebedor"
"Recipient","Recebedor"
"Save","Salvar"
"Back","Voltar"
"Can't create recipient. Please review the information and try again.","Não foi possível criar o recebedor. Por favor revise os dados e tente novamente."
Expand Down
6 changes: 3 additions & 3 deletions view/adminhtml/templates/marketplace/recipients/create.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ $editRecipient = $block->getEditRecipient(); ?>
<div class="admin__field-control">
<input type="text" class="recipient-form-inputs"
name="form[register_information][document]" id="document"
placeholder="000.000.000-00" maxlength="14"
placeholder="000.000.000-00"
data-document-number-for="seller"
data-document-mask data-toggle-required>
</div>
Expand Down Expand Up @@ -587,7 +587,7 @@ $editRecipient = $block->getEditRecipient(); ?>
<input type="text" class="recipient-form-inputs"
name="form[register_information][managing_partners][0][document]"
id="recipient-partner-0-document" placeholder="000.000.000-00"
maxlength="14" data-document-mask data-toggle-required>
data-document-mask data-toggle-required>
</div>
</div>

Expand Down Expand Up @@ -842,7 +842,7 @@ $editRecipient = $block->getEditRecipient(); ?>
<div class="admin__field-control">
<input type="text" class="recipient-form-inputs"
name="form[holder_document]" id="holder-document"
placeholder="000.000.000-00" maxlength="14" readonly data-document-mask
placeholder="000.000.000-00" readonly data-document-mask
data-toggle-required>
</div>
</div>
Expand Down
12 changes: 3 additions & 9 deletions view/adminhtml/web/js/recipients.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,14 @@ require([
});

function changeDocumentFieldsByType(documentType) {
const config = {
'mask': documentType === 'corporation' ? cnpjMask : cpfMask,
'maxLength': documentType === 'corporation' ? cnpjMax : cpfMax
};
const documentMask = documentType === 'corporation' ? cnpjMask : cpfMask;

$(fieldId['holderDocumentType'])
.val(documentTypeCorporationToCompany(documentType));

$('#document, #holder-document')
.attr({
'placeholder': config.mask,
'maxLength': config.maxLength
})
.mask(config.mask);
.attr('placeholder', documentMask)
.mask(documentMask);
}

function documentTypeCorporationToCompany(documentType) {
Expand Down

0 comments on commit f999d0f

Please sign in to comment.