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

Introducing invoice handling from the order editor #187

Merged
merged 6 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Work in progress: Initiating work around invoice number meta box for …
…orders
  • Loading branch information
aldavigdis committed Aug 5, 2024
commit a531e36ee553f5d40ed621b708059ff1899bf468
2 changes: 1 addition & 1 deletion src/Hooks/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function __construct() {

public static function add_dk_invoice_metabox() {
add_meta_box(
'1984-dk-woo-dk-invoice-metabox',
'nineteen-eighty-woo-dk-invoice-metabox',
__( 'DK Invoice', '1984-dk-woo' ),
array( __CLASS__, 'render_dk_invoice_metabox' ),
'shop_order',
Expand Down
30 changes: 30 additions & 0 deletions style/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,36 @@ table .column-dk_invoice_id .invoice_error {
font-weight: 600;
}

#nineteen-eighty-woo-dk-invoice-metabox .input-set {
margin: 1rem 0;
}

#nineteen-eighty-woo-dk-invoice-metabox .input {
display: flex;
flex-direction: column;
margin: 0.5rem 0;
}

#nineteen-eighty-woo-dk-invoice-metabox .input label {
font-weight: 600;
margin-bottom: 0.25rem;
}

#nineteen-eighty-woo-dk-invoice-metabox input[type="text"] {
width: 100%;
}

#nineteen-eighty-woo-dk-invoice-metabox .buttons {
display: flex;
flex-direction: row;
align-items: center;
margin: 0.5rem 0;
}

#nineteen-eighty-woo-dk-invoice-metabox .buttons button {
margin-right: 0.5rem;
}

@media screen and (max-width: 782px) {
#nineteen-eighty-woo-wrap h1 {
margin-left: 21px;
Expand Down
51 changes: 36 additions & 15 deletions views/dk_invoice_metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,50 @@

?>

<div>
<div>
<label>Invoice Number</label>
<div
class="input-set"
aria-labelledby="1984-dk-woo-dk-invoice-metabox-invoice-number-label"
>
<div class="input">
<label id="1984-dk-woo-dk-invoice-metabox-invoice-number-label" for="1984-dk-woo-dk-invoice-metabox-invoice-number-input">Invoice Number</label>
<input
id="1984-dk-woo-dk-invoice-metabox-invoice-number-input"
class="regular-text"
name="1984_woo_dk_invoice_number"
type="text"
value="<?php echo esc_attr( $invoice_number ); ?>"
/>
</div>
<div>
<button class="button button-small button-secondary">Set Invoice Number</button>
<button class="button button-small button-primary">Create in DK</button>
<div class="buttons">
<button class="button button-small button-secondary">Update</button>
<button class="button button-small button-primary" disabled>Create in DK</button>
<img
class="loader"
src="<?php echo esc_url( get_admin_url() . 'images/wpspin_light-2x.gif' ); ?>"
width="16"
height="16"
/>
</div>
</div>

<div>
<label>Credit Invoice Number</label>
<input
name="1984_woo_dk_credit_invoice_number"
type="text"
value="<?php echo esc_attr( $credit_invoice_number ); ?>"
/>
<div>
<button class="button button-small button-secondary">Set Credit Invoice Number</button>
<div class="input-set">
<div class="input">
<label for="1984-dk-woo-dk-invoice-metabox-credit-invoice-number-input">Credit Invoice Number</label>
<input
id="1984-dk-woo-dk-invoice-metabox-credit-invoice-number-input"
class="regular-text"
name="1984_woo_dk_credit_invoice_number"
type="text"
value="<?php echo esc_attr( $credit_invoice_number ); ?>"
/>
</div>
<div class="buttons">
<button class="button button-small button-secondary">Update</button>
<img
class="loader"
src="<?php echo esc_url( get_admin_url() . 'images/wpspin_light-2x.gif' ); ?>"
width="16"
height="16"
/>
</div>
</div>