Skip to content

Commit

Permalink
Linting the order js
Browse files Browse the repository at this point in the history
  • Loading branch information
aldavigdis committed Aug 6, 2024
1 parent 3b0243a commit 7cef7b1
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions js/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class NineteenEightyWooOrder {
order_id: postID,
invoice_number: invoiceNumber,
};

const response = await fetch(
wpApiSettings.root + 'NineteenEightyWoo/v1/order_invoice_number',
{
Expand Down Expand Up @@ -204,17 +205,17 @@ class NineteenEightyWooOrder {

if ( /^[1-9][0-9]{0,}$/.test( invoiceNumber ) ) {
this.updateInvoiceButton().disabled = false;
this.getPdfButton().disabled = false;
this.invoiceNumberInvalid().classList.add('hidden');
this.getPdfButton().disabled = false;
this.invoiceNumberInvalid().classList.add( 'hidden' );
} else {
this.updateInvoiceButton().disabled = true;
this.getPdfButton().disabled = true;
this.invoiceNumberInvalid().classList.remove('hidden');
this.getPdfButton().disabled = true;
this.invoiceNumberInvalid().classList.remove( 'hidden' );
}

if ( invoiceNumber === '' ) {
this.createDkInvoiceButton().disabled = false;
this.invoiceNumberInvalid().classList.add('hidden');
this.invoiceNumberInvalid().classList.add( 'hidden' );
} else {
this.createDkInvoiceButton().disabled = true;
}
Expand All @@ -227,16 +228,16 @@ class NineteenEightyWooOrder {

if ( /^[1-9][0-9]{0,}$/.test( creditInvoiceNumber ) ) {
this.updateCreditInvoiceButton().disabled = false;
this.getCreditPdfButton().disabled = false;
this.creditInvoiceInvalid().classList.add('hidden');
this.getCreditPdfButton().disabled = false;
this.creditInvoiceInvalid().classList.add( 'hidden' );
} else {
this.updateCreditInvoiceButton().disabled = true;
this.getCreditPdfButton().disabled = true;
this.creditInvoiceInvalid().classList.remove('hidden');
this.getCreditPdfButton().disabled = true;
this.creditInvoiceInvalid().classList.remove( 'hidden' );
}

if ( creditInvoiceNumber === '' ) {
this.creditInvoiceInvalid().classList.add('hidden');
this.creditInvoiceInvalid().classList.add( 'hidden' );
}
}

Expand All @@ -255,13 +256,13 @@ class NineteenEightyWooOrder {
if ( response ) {
this.invoiceLoader().classList.add( 'hidden' );
this.updateInvoiceButton().disabled = false;
this.invoiceNumberInput().value = '';
this.invoiceNumberInput().value = '';
}

if ( response.ok ) {
const json = await response.json();
const json = await response.json();
this.invoiceNumberInput().value = json;
this.getPdfButton().disabled = false;
this.getPdfButton().disabled = false;
}
}

Expand Down

0 comments on commit 7cef7b1

Please sign in to comment.