Skip to content

Commit

Permalink
Merge pull request ochoarobert1#5 from ochoarobert1/feature/invoice
Browse files Browse the repository at this point in the history
Feature/invoice
  • Loading branch information
ochoarobert1 authored Mar 4, 2024
2 parents 8a9d234 + e32a231 commit 23a13de
Show file tree
Hide file tree
Showing 6 changed files with 373 additions and 170 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
push:
branches:
- develop
name: 🚀 Deploy website on push
jobs:
web-deploy:
name: 🎉 Deploy
runs-on: ubuntu-latest
steps:
- name: 🚚 Get latest code
uses: actions/checkout@v3

- name: 📂 Sync files
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.ftp_server }}
username: ${{ secrets.ftp_username }}
password: ${{ secrets.ftp_password }}
log-level: minimal
exclude: |
**/.git*
**/.git*/**
**/node_modules/**
27 changes: 19 additions & 8 deletions admin/class-ccontrol-dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ public function register_ccontrol_settings()
register_setting('ccontrol-group', 'ccontrol_invoice_number');
register_setting('ccontrol-group', 'ccontrol_invoice_last_post_change');
register_setting('ccontrol-group', 'ccontrol_budget_conditions');
register_setting('ccontrol-group', 'ccontrol_budget_accounts');
register_setting('ccontrol-group', 'ccontrol_budget_accounts_venezuela');
register_setting('ccontrol-group', 'ccontrol_budget_accounts_usa');
register_setting('ccontrol-group', 'ccontrol_budget_accounts_paypal');
}

public function ccontrol_options()
Expand Down Expand Up @@ -107,24 +109,33 @@ public function ccontrol_options()
<td><input type="text" name="ccontrol_invoice_number" value="<?php echo esc_attr(get_option('ccontrol_invoice_number')); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Términos y Condiciones en Factura', 'ccontrol'); ?></th>
<th scope="row"><?php _e('Términos y Condiciones en Factura por defecto', 'ccontrol'); ?></th>
<td>
<textarea name="ccontrol_budget_conditions" id="ccontrol_budget_conditions" cols="80" rows="5"><?php echo esc_attr(get_option('ccontrol_budget_conditions')); ?></textarea>
<textarea name="ccontrol_budget_conditions" id="ccontrol_budget_conditions" cols="80" rows="5"><?php echo esc_html(get_option('ccontrol_budget_conditions')); ?></textarea>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Números de Cuentas para Pago en Factura', 'ccontrol'); ?></th>
<th scope="row"><?php _e('Números de Cuentas para Pago en Factura (Venezuela)', 'ccontrol'); ?></th>
<td>
<textarea name="ccontrol_budget_accounts" id="ccontrol_budget_accounts" cols="80" rows="5"><?php echo esc_attr(get_option('ccontrol_budget_accounts')); ?></textarea>
<textarea name="ccontrol_budget_accounts_venezuela" id="ccontrol_budget_accounts_venezuela" cols="80" rows="8"><?php echo esc_html(get_option('ccontrol_budget_accounts_venezuela')); ?></textarea>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Números de Cuentas para Pago en Factura (USA)', 'ccontrol'); ?></th>
<td>
<textarea name="ccontrol_budget_accounts_usa" id="ccontrol_budget_accounts_usa" cols="80" rows="15"><?php echo esc_html(get_option('ccontrol_budget_accounts_usa')); ?></textarea>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Números de Cuentas para Pago en Factura (PayPal)', 'ccontrol'); ?></th>
<td>
<textarea name="ccontrol_budget_accounts_paypal" id="ccontrol_budget_accounts_paypal" cols="80" rows="5"><?php echo esc_html(get_option('ccontrol_budget_accounts_paypal')); ?></textarea>
</td>
</tr>
</table>
<?php submit_button(); ?>
</form>
</div>
<script type="text/javascript">

</script>
<?php
$content = ob_get_clean();
echo $content;
Expand Down
2 changes: 1 addition & 1 deletion admin/css/ccontrol-admin.css

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

75 changes: 75 additions & 0 deletions admin/css/ccontrol-admin.less
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,79 @@ img.cc_clientes_logo {
.cc-btn-100 {
width: 100%;
text-align: center;
}

.postmeta-items-container {
width: 100%;
padding-right: 1rem;

.row-postmeta-items {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
background: #f1f1f1;
padding: 10px 10px 5px;
border: 1px solid #dfdfdf;
gap: 3px;
max-width: 100%;

.col-postmeta-item {
display: inline-flex;
flex-flow: column;

button.item-factura-add {
width: 40px;
height: 40px;
border-radius: 100%;
background: #09d509;
border: 0;
color: #FFF;
font-size: 1.6rem;
display: inline-flex;
align-items: center;
justify-content: center;
padding-bottom: 8px;
cursor: pointer;
}

button.item-factura-remove {
width: 40px;
height: 40px;
border-radius: 100%;
background: #ca3434;
border: 0;
color: #FFF;
font-size: 1.6rem;
display: inline-flex;
align-items: center;
justify-content: center;
padding-bottom: 8px;
cursor: pointer;
}

label {
margin-bottom: 2px;
}

&:nth-child(1) {
flex: 0 0 60%;
}

&:nth-child(2) {
flex: 0 0 15%;
}

&:nth-child(3) {
flex: 0 0 15%;
}

&:nth-child(4) {
flex: 0 0 9%;
flex-flow: row;
justify-content: center;
gap: 10px;
}
}
}
}
141 changes: 83 additions & 58 deletions admin/js/ccontrol-admin.js
Original file line number Diff line number Diff line change
@@ -1,68 +1,93 @@
(function ($) {
'use strict';
"use strict";

$(document).on('ready', function () {
console.log('loaded');
$(document).on("ready", function () {
console.log("loaded");

$('#printQuote').on('click', function (e) {
e.preventDefault();
console.log('clicked');
window.open(ajaxurl + '?action=ccontrol_create_pdf&postid=' + jQuery('#printQuote').data('id'), '_blank');
});

$('#sendQuote').on('click', function (e) {
e.preventDefault();
console.log('clicked');
$.ajax({
type: 'POST',
url: ajaxurl,
data: {
action: 'ccontrol_create_pdf_send',
postid: jQuery('#sendQuote').data('id')
},
success: function (response) {
console.log(response);

}
});
});
$("#printQuote").on("click", function (e) {
e.preventDefault();
console.log("clicked");
window.open(
ajaxurl +
"?action=ccontrol_create_pdf&postid=" +
jQuery("#printQuote").data("id"),
"_blank"
);
});

$('#printInvoice').on('click', function (e) {
e.preventDefault();
console.log('clicked');
window.open(ajaxurl + '?action=ccontrol_create_invoice_pdf&postid=' + jQuery('#printInvoice').data('id'), '_blank');
});
$("#sendQuote").on("click", function (e) {
e.preventDefault();
console.log("clicked");
$.ajax({
type: "POST",
url: ajaxurl,
data: {
action: "ccontrol_create_pdf_send",
postid: jQuery("#sendQuote").data("id"),
},
success: function (response) {
console.log(response);
},
});
});

$('#sendInvoice').on('click', function (e) {
e.preventDefault();
console.log('clicked');
$.ajax({
type: 'POST',
url: ajaxurl,
data: {
action: 'ccontrol_create_invoice_pdf_send',
postid: jQuery('#sendInvoice').data('id')
},
success: function (response) {
console.log(response);
$("#printInvoice").on("click", function (e) {
e.preventDefault();
console.log("clicked");
window.open(
ajaxurl +
"?action=ccontrol_create_invoice_pdf&postid=" +
jQuery("#printInvoice").data("id"),
"_blank"
);
});

}
});
});
$("#sendInvoice").on("click", function (e) {
e.preventDefault();
console.log("clicked");
$.ajax({
type: "POST",
url: ajaxurl,
data: {
action: "ccontrol_create_invoice_pdf_send",
postid: jQuery("#sendInvoice").data("id"),
},
success: function (response) {
console.log(response);
},
});
});

$('#upload-btn').click(function (e) {
e.preventDefault();
var image = wp.media({
title: 'Upload Image',
multiple: false
}).open()
.on('select', function (e) {
var uploaded_image = image.state().get('selection').first();
var image_url = uploaded_image.toJSON().url;
$('#image_url').val(image_url);
$('#ccontrol_logo').attr('src', image_url);
});
$("#upload-btn").click(function (e) {
e.preventDefault();
var image = wp
.media({
title: "Upload Image",
multiple: false,
})
.open()
.on("select", function (e) {
var uploaded_image = image.state().get("selection").first();
var image_url = uploaded_image.toJSON().url;
$("#image_url").val(image_url);
$("#ccontrol_logo").attr("src", image_url);
});
});

})(jQuery);
$(document).on("click", ".item-factura-add", function (e) {
e.preventDefault();
console.log("clicked");
var item = $(this).parent().parent();
var clone = item.clone();
clone.find("input").val("");
clone.find(".item-factura-remove").show();
item.after(clone);
});
$(document).on("click", ".item-factura-remove", function (e) {
e.preventDefault();
console.log("clicked");
var item = $(this).parent().parent();
item.remove();
});
});
})(jQuery);
Loading

0 comments on commit 23a13de

Please sign in to comment.