Skip to content
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

Improvements for "PDF document data" metabox #757

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
72c030f
Move PDF document data markup to views
MohamadNateqi Mar 28, 2024
69e9b3d
WPCS
MohamadNateqi Mar 28, 2024
34ee8d1
Update and improvements for metabox markup
MohamadNateqi Mar 28, 2024
e39996f
Add auto update documents data using heartbeat
MohamadNateqi Mar 28, 2024
0058f6f
Generate minified JS and CSS files
MohamadNateqi Mar 28, 2024
ac6ec0d
Fix nonce validation
MohamadNateqi Apr 3, 2024
6ecfebe
Validate the document type
MohamadNateqi Apr 3, 2024
2251d16
Improve performance
MohamadNateqi Apr 3, 2024
00c299c
Better sanitize
MohamadNateqi Apr 3, 2024
ed6bc11
WPCS
MohamadNateqi Apr 3, 2024
7fd96b7
Add DocBlock
MohamadNateqi Apr 3, 2024
75c411b
Improvement
MohamadNateqi Apr 3, 2024
acc87cb
Fix bugs
MohamadNateqi Apr 3, 2024
2b66b21
Indentation fixes
alexmigf Apr 3, 2024
46ee270
Improve the meta box method to print all documents data,
MohamadNateqi Apr 9, 2024
bcbb368
Update version
MohamadNateqi Apr 9, 2024
969f928
Merge branch 'main' into document-data-metabox
alexmigf Apr 10, 2024
69e812e
Rename a parameter
MohamadNateqi Apr 10, 2024
146180c
Fix HPOS compatibility
MohamadNateqi Apr 10, 2024
0d02eda
Fix input width issue on Firefox
MohamadNateqi Apr 10, 2024
fedccf6
Merge branch 'main' into document-data-metabox
MohamadNateqi Apr 10, 2024
b407d25
Merge remote-tracking branch 'origin/document-data-metabox' into docu…
MohamadNateqi Apr 10, 2024
8fa23bf
Generate minified JS and CSS files
MohamadNateqi Apr 10, 2024
ab89e8c
Fix a bug
MohamadNateqi Apr 10, 2024
d19708a
Rename a parameter
MohamadNateqi Apr 12, 2024
bcccb26
Fix not removing dependent document
MohamadNateqi Apr 12, 2024
f9cbcca
Check if we have an order ID
MohamadNateqi Apr 12, 2024
8f7c72c
Better name for a hook
MohamadNateqi Apr 12, 2024
db3c341
Use another AS method
MohamadNateqi Apr 12, 2024
46e8aa9
Generate minified JS and CSS files
MohamadNateqi Apr 12, 2024
a13139e
Merge branch 'main' into document-data-metabox
MohamadNateqi Apr 12, 2024
813e746
Add document number to output
MohamadNateqi Apr 15, 2024
e424202
Revert outputting all documents in the meta box
MohamadNateqi Apr 15, 2024
721ef11
Merge branch 'main' into document-data-metabox
MohamadNateqi Apr 15, 2024
a58ff0f
Improvements for the default data labels
MohamadNateqi Apr 15, 2024
df58528
WPCS
MohamadNateqi Apr 16, 2024
0bbec3f
Improvement
MohamadNateqi Apr 16, 2024
55b47a8
Update the usage of a filter
MohamadNateqi Apr 16, 2024
a6c5927
Introducing a new propery in Order_Document class to store prerequisi…
MohamadNateqi Apr 16, 2024
48d0371
Check document prerequisites in `is_allowed()` method
MohamadNateqi Apr 17, 2024
2a9d4e9
Introduce the new `do_prerequisites_exist()` method
MohamadNateqi Apr 17, 2024
2393848
Remove an unnecessary filter
MohamadNateqi Apr 17, 2024
8c6ed82
Update `pdf_actions_meta_box()` method
MohamadNateqi Apr 17, 2024
c391c99
Updates
MohamadNateqi Apr 17, 2024
6e4349d
Merge branch 'main' into document-data-metabox
MohamadNateqi Apr 17, 2024
08cff80
Revert changes and improvements
MohamadNateqi Apr 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions assets/css/order-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@

#wpo_wcpdf-data-input-box .form-field input {
width: auto;
min-width: 5em;
}

.wcpdf-data-fields {
Expand Down
2 changes: 1 addition & 1 deletion assets/css/order-styles.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 41 additions & 1 deletion assets/js/order-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,45 @@ jQuery( function( $ ) {
$( '.view-more' ).show();
}
} );


// send pending documents with heartbeat to fetch data
$( document ).on( 'heartbeat-send', function( e, data ) {
let pending_documents = [];
$( '.wcpdf-data-fields' ).each( function () {
if ( 'yes' === $( this ).attr( 'data-is_pending' ) ) {
pending_documents.push( $( this ).data( 'document' ) );
}
} );

if ( pending_documents.length > 0 ) {
data.wpo_wcpdf_pending_documents = pending_documents;
}
} );

// fetch data for pending documents if documents are generated
$( document ).on( 'heartbeat-tick', function( e, data ) {
if ( ! data.wpo_wcpdf_ready_documents ) {
return;
}

$.ajax( {
url: wpo_wcpdf_ajax.ajaxurl,
type: 'POST',
data: {
action: 'wpo_fetch_document_data',
security: wpo_wcpdf_ajax.nonce,
document_types: data.wpo_wcpdf_ready_documents.document_types,
order_id: data.wpo_wcpdf_ready_documents.order_id,
},
success: function ( response ) {
$.each( response.data, function ( key, value ) {
$( '.wcpdf-data-fields[data-document="' + key + '"]' ).replaceWith( value );
} );
},
error: function ( response ) {
console.log( response.message );
}
} );
} );

} );
2 changes: 1 addition & 1 deletion assets/js/order-script.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading