Plugin Directory

Changeset 3018666

Timestamp:
01/08/2024 09:40:56 AM (7 months ago)
Author:
them.es
Message:

updated trunk

Location:
billy
Files:
727 added
5 edited

Legend:

Unmodified
Added
Removed
  • billy/trunk/billy.php

    r3016777 r3018666  
    44 * Plugin URI: https://wordpress.org/plugins/billy
    55 * Description: A business-oriented billing suite powered by WordPress.
    6  * Version: 1.7.0
     6 * Version: 1.7.
    77 * Author: them.es
    88 * Author URI: https://them.es/plugins/billy
  • billy/trunk/blocks/build/index.asset.php

    r3016777 r3018666  
    1 <?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-server-side-render'), 'version' => 'c686d977bd1d4e4da963');
     1<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-server-side-render'), 'version' => '');
  • billy/trunk/blocks/build/index.js

    r3016777 r3018666  
    1 (()=>{"use strict";var e={n:t=>{var l=t&&t.__esModule?()=>t.default:()=>t;return e.d(l,{a:l}),l},d:(t,l)=>{for(var a in l)e.o(l,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:l[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.element,l=window.wp.blocks,a=window.wp.i18n,n=window.wp.blockEditor,s=window.wp.components,r=window.wp.serverSideRender;var c=e.n(r);(0,l.registerBlockType)("billy-blocks/header",{title:(0,a.__)("Header","billy"),icon:"editor-table",category:"billy-blocks",supports:{inserter:!1,reusable:!1,html:!1},getEditWrapperProps:()=>({"data-align":"wide"}),edit:e=>(0,t.createElement)(t.Fragment,null,(0,t.createElement)(n.InspectorControls,null,(0,t.createElement)(s.PanelBody,{title:(0,a.__)("Info","billy")},(0,t.createElement)("div",{className:"components-notice"},(0,t.createElement)("div",{className:"components-notice__content"},(0,t.createElement)("a",{href:globalDataBilly.wpAdmin+"edit.php?post_type=wp_block"},(0,a.sprintf)((0,a.__)("Edit the %s layout","billy"),(0,a.__)("Header","billy"))))),(0,t.createElement)("div",{className:"components-notice"},(0,t.createElement)("div",{className:"components-notice__content"},(0,a.sprintf)((0,a.__)("The %s values can be modified in the Theme Customizer.","billy"),(0,a.__)("Header","billy")))))),(0,t.createElement)(s.Disabled,null,(0,t.createElement)(c(),{block:"billy-blocks/header"}))),save:e=>null});const i=window.React,o=window.wp.data;(0,l.registerBlockType)("billy-blocks/invoice-actions",{apiVersion:2,title:(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Invoice","billy"),(0,a.__)("Actions","billy")),icon:"menu-alt",category:"billy-blocks",supports:{inserter:!1,reusable:!1,html:!1},getEditWrapperProps:()=>({"data-align":"wide"}),edit:(0,o.withSelect)((e=>({postModifiedDate:e("core/editor").getEditedPostAttribute("modified")})))((e=>{const{postModifiedDate:t}=e,l=(0,n.useBlockProps)({className:"components-placeholder",style:{minHeight:"auto"}});return(0,i.createElement)("div",{...l},(0,i.createElement)("small",null,(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Last modified","billy"),new Date(t).toLocaleString())))})),save:()=>null}),(0,l.registerBlockType)("billy-blocks/invoice-meta",{apiVersion:2,title:(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Invoice","billy"),(0,a.__)("Meta","billy")),icon:"editor-textcolor",category:"billy-blocks",attributes:{label:{type:"string",default:""},text:{type:"string",default:""}},supports:{inserter:!1,reusable:!1,html:!1,className:!1},edit:e=>{const{attributes:{label:l,text:r},setAttributes:c}=e,o=(0,n.useBlockProps)();return(0,i.createElement)("div",{...o},(0,i.createElement)(n.InspectorControls,null,(0,i.createElement)(s.PanelBody,{title:(0,a.__)("Label","billy")},(0,i.createElement)(s.TextControl,{type:"text",className:"label",value:l,onChange:e=>{c({label:e})}})),(0,i.createElement)(s.PanelBody,{title:(0,a.__)("Text","billy")},(0,i.createElement)(s.TextControl,{type:"text",className:"text",value:r,onChange:e=>{c({text:e})}}))),(0,i.createElement)(t.RawHTML,null,(0,a.sprintf)((0,a.__)('<div class="label">%1$s</div> <div class="text">%2$s</div>',"billy"),l||"",r||(0,a.__)("N/A","billy"))))},save:e=>{const{attributes:{label:l,text:n}}=e;return n&&(0,i.createElement)(t.RawHTML,null,(0,a.sprintf)((0,a.__)('<div class="label">%1$s</div> <div class="text">%2$s</div>',"billy"),l||"",n||(0,a.__)("N/A","billy")))},deprecated:[{attributes:{label:{type:"string",default:""},text:{type:"string",default:""}},save:e=>{const{className:l,attributes:{label:n,text:s}}=e;return s&&(0,i.createElement)(t.RawHTML,null,(0,a.sprintf)((0,a.__)('<div class="label">%1$s</div> <div class="text">%2$s</div>',"billy"),n||"",s||(0,a.__)("N/A","billy")))}},{attributes:{label:{type:"string",default:""},text:{type:"string",default:""}},save:e=>{const{className:l,attributes:{label:n,text:s}}=e;return s&&(0,i.createElement)("p",null,(0,i.createElement)(t.RawHTML,null,(0,a.sprintf)("<p>"+(0,a.__)("<strong>%1$s</strong> <span>%2$s</span>","billy")+"</p>",n||"",s||(0,a.__)("N/A","billy"))))}}]}),(0,l.registerBlockType)("billy-blocks/invoice-date",{apiVersion:2,title:(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Invoice","billy"),(0,a.__)("Date","billy")),icon:"calendar-alt",category:"billy-blocks",supports:{inserter:!1,reusable:!1,html:!1},edit:()=>{const e=(0,n.useBlockProps)();return(0,i.createElement)("div",{...e},(0,i.createElement)(n.InspectorControls,null,(0,i.createElement)(s.PanelBody,{title:(0,a.__)("Info","billy")},(0,i.createElement)("div",{className:"components-notice is-warning"},(0,i.createElement)("div",{className:"components-notice__content"},(0,a.sprintf)((0,a.__)("Due to legal requirements in some countries, autogenerated data like %s can't be modified anymore after an invoice has been created in the system!","billy"),(0,a.__)("Date","billy")))))),(0,i.createElement)(s.Disabled,null,(0,i.createElement)(c(),{block:"billy-blocks/invoice-date"})))},save:()=>null}),(0,l.registerBlockType)("billy-blocks/invoice-duedate",{apiVersion:2,title:(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Invoice","billy"),(0,a.__)("Due Date","billy")),icon:"calendar-alt",category:"billy-blocks",supports:{inserter:!1,reusable:!1,html:!1},edit:()=>{const e=(0,n.useBlockProps)();return(0,i.createElement)("div",{...e},(0,i.createElement)(n.InspectorControls,null,(0,i.createElement)(s.PanelBody,{title:(0,a.__)("Info","billy")},(0,i.createElement)("div",{className:"components-notice"},(0,i.createElement)("div",{className:"components-notice__content"},(0,a.sprintf)((0,a.__)("The %s values can be modified in the Theme Customizer.","billy"),(0,a.__)("Payment due days","billy")))))),(0,i.createElement)(s.Disabled,null,(0,i.createElement)(c(),{block:"billy-blocks/invoice-duedate"})))},save:()=>null}),(0,l.registerBlockType)("billy-blocks/invoice-number",{apiVersion:2,title:(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Invoice","billy"),(0,a.__)("Number","billy")),icon:"editor-ol",category:"billy-blocks",supports:{inserter:!1,reusable:!1,html:!1},edit:()=>{const e=(0,n.useBlockProps)();return(0,i.createElement)("div",{...e},(0,i.createElement)(n.InspectorControls,null,(0,i.createElement)(s.PanelBody,{title:(0,a.__)("Info","billy")},(0,i.createElement)("div",{className:"components-notice"},(0,i.createElement)("div",{className:"components-notice__content"},(0,a.sprintf)((0,a.__)("The %s values can be modified in the Theme Customizer.","billy"),(0,a.__)("Invoice number: Prefix","billy")))),(0,i.createElement)("div",{className:"components-notice is-warning"},(0,i.createElement)("div",{className:"components-notice__content"},(0,a.sprintf)((0,a.__)("Due to legal requirements in some countries, autogenerated data like %s can't be modified anymore after an invoice has been created in the system!","billy"),(0,a.__)("Invoice number","billy")))))),(0,i.createElement)(s.Disabled,null,(0,i.createElement)(c(),{block:"billy-blocks/invoice-number"})))},save:()=>null}),(0,l.registerBlockType)("billy-blocks/invoice-paymentinformation",{apiVersion:2,title:(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Invoice","billy"),(0,a.__)("Payment Information","billy")),icon:"info",category:"billy-blocks",supports:{inserter:!1,reusable:!1,html:!1},edit:()=>{const e=(0,n.useBlockProps)();return(0,i.createElement)("div",{...e},(0,i.createElement)(n.InspectorControls,null,(0,i.createElement)(s.PanelBody,{title:(0,a.__)("Info","billy")},(0,i.createElement)("div",{className:"components-notice"},(0,i.createElement)("div",{className:"components-notice__content"},(0,a.sprintf)((0,a.__)("The %s values can be modified in the Theme Customizer.","billy"),(0,a.__)("Payment Information","billy")))))),(0,i.createElement)(s.Disabled,null,(0,i.createElement)(c(),{block:"billy-blocks/invoice-paymentinformation"})))},save:()=>null});const m=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return e.toLocaleString(t,{minimumFractionDigits:2,maximumFractionDigits:2})},u=e=>parseFloat(e)/100,b=e=>(e=new Date(e)||new Date,[1,2,3,4][Math.floor(e.getMonth()/3)]),p=[{attributes:{currency:{type:"string",default:""},locale:{type:"string",default:""},amountSubtotal:{type:"number",default:""},amountTotal:{type:"number",default:""},taxRates:{type:"string",default:""},taxRatesTotal:{type:"number",default:""}},save:e=>{const{className:l,attributes:{currency:s,locale:r,amountSubtotal:c,amountTotal:i,taxRates:o,taxRatesTotal:b}}=e;return(0,t.createElement)("div",{className:"invoicetable-block alignwide"+(l?" "+l:"")},(0,t.createElement)("table",{className:"table wp-block-table"},(0,t.createElement)("thead",null,(0,t.createElement)("tr",null,(0,t.createElement)("th",{scope:"col"},(0,a.__)("#","billy")),(0,t.createElement)("th",{scope:"col"},(0,a.__)("Description","billy")),(0,t.createElement)("th",{scope:"col"},(0,a.__)("Amount","billy")),o&&b>0&&(0,t.createElement)("th",{scope:"col"},(0,a.__)("Tax","billy")))),(0,t.createElement)("tbody",null,(0,t.createElement)(n.InnerBlocks.Content,null)),(0,t.createElement)("tfoot",null,c>0&&(0,t.createElement)("tr",{className:"subtotal"},(0,t.createElement)("td",{colSpan:"2",className:"align-right"},i>c?(0,a.__)("Subtotal","billy"):(0,a.__)("Total","billy")),(0,t.createElement)("td",{colSpan:o&&b>0?"2":null},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(c,r)))),o&&b>0&&(0,t.createElement)("tr",{className:"taxrates"},(0,t.createElement)("td",{colSpan:"2",className:"align-right"},(0,a.__)("Tax","billy")),(0,t.createElement)("td",{colSpan:o&&b>0?"2":null},JSON.parse(o).sort(((e,t)=>u(e.taxRate)-u(t.taxRate))).map(((e,l)=>{if(e.amount>0)return(0,t.createElement)(t.RawHTML,{key:l},(0,a.sprintf)((0,a.__)("%1$s %2$s %3$s","billy"),s,m(e.amount,r),"<small>("+e.taxRate+")</small><br>"))})))),i>c&&(0,t.createElement)("tr",{className:"total"},(0,t.createElement)("td",{colSpan:"2",className:"align-right"},(0,a.__)("Total","billy")),(0,t.createElement)("td",{colSpan:o&&b>0?"2":null},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(i,r)))))))}},{attributes:{currency:{type:"string",default:""},locale:{type:"string",default:""},amountSubtotal:{type:"number",default:""},amountTotal:{type:"number",default:""},taxRates:{type:"string",default:""},taxRatesTotal:{type:"number",default:""}},save:e=>{const{className:l,attributes:{currency:s,locale:r,amountSubtotal:c,amountTotal:i,taxRates:o,taxRatesTotal:b}}=e;return(0,t.createElement)("div",{className:"invoicetable-block alignwide"+(l?" "+l:"")},(0,t.createElement)("table",{className:"table wp-block-table"},(0,t.createElement)("thead",null,(0,t.createElement)("tr",null,(0,t.createElement)("th",{scope:"col"},(0,a.__)("#","billy")),(0,t.createElement)("th",{scope:"col"},(0,a.__)("Description","billy")),(0,t.createElement)("th",{scope:"col"},(0,a.__)("Amount","billy")),o&&b>0&&(0,t.createElement)("th",{scope:"col"},(0,a.__)("Tax","billy")))),(0,t.createElement)("tbody",null,(0,t.createElement)(n.InnerBlocks.Content,null)),(0,t.createElement)("tfoot",null,c>0&&(0,t.createElement)("tr",{className:"subtotal"},(0,t.createElement)("td",{colSpan:"2",align:"right"},i>c?(0,a.__)("Subtotal","billy"):(0,a.__)("Total","billy")),(0,t.createElement)("td",null,(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(c,r)))),o&&b>0&&(0,t.createElement)("tr",{className:"taxrates"},(0,t.createElement)("td",{colSpan:"2",align:"right"},(0,a.__)("Tax","billy")),(0,t.createElement)("td",null,JSON.parse(o).sort(((e,t)=>u(e.taxRate)-u(t.taxRate))).map(((e,l)=>{if(e.amount>0)return(0,t.createElement)(t.RawHTML,{key:l},(0,a.sprintf)((0,a.__)("%1$s %2$s %3$s","billy"),s,m(e.amount,r),"<small>("+e.taxRate+")</small><br>"))})))),i>c&&(0,t.createElement)("tr",{className:"total"},(0,t.createElement)("td",{colSpan:"2",align:"right"},(0,a.__)("Total","billy")),(0,t.createElement)("td",null,(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(i,r)))))))}}],d=[{attributes:{index:{type:"number",default:"0"},currency:{type:"string",default:""},locale:{type:"string",default:""},description:{type:"string",default:""},taxRate:{type:"string",default:""},amount:{type:"number",default:""},amountIncl:{type:"number",default:""},quantity:{type:"number",default:""},quantityRate:{type:"number",default:""}},save:e=>{const{className:l,attributes:{index:s,locale:r,taxRate:c,amount:o}}=e;return(0,i.createElement)("tr",null,(0,i.createElement)("th",{scope:"row"},s&&s),(0,i.createElement)("td",null,(0,i.createElement)(n.InnerBlocks.Content,null)),(0,i.createElement)("td",null,o&&m(o,r)),c&&u(c)*o>0&&(0,i.createElement)("td",null,(0,i.createElement)(t.RawHTML,null,(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),m(u(c)*o,r),"<small>("+c+")</small>"))))}},{attributes:{index:{type:"number",default:"0"},currency:{type:"string",default:""},locale:{type:"string",default:""},description:{type:"string",default:""},taxRate:{type:"string",default:""},amount:{type:"number",default:""},amountIncl:{type:"number",default:""},quantity:{type:"number",default:""},quantityRate:{type:"number",default:""}},save:e=>{const{className:l,attributes:{index:n,locale:s,description:r,taxRate:c,amount:o}}=e;return(0,i.createElement)("tr",null,(0,i.createElement)("th",{scope:"row"},n&&n),(0,i.createElement)("td",null,r&&(0,i.createElement)(t.RawHTML,null,r)),(0,i.createElement)("td",null,o&&m(o,s)),c&&u(c)*o>0&&(0,i.createElement)("td",null,(0,i.createElement)(t.RawHTML,null,(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),m(u(c)*o,s),"<small>("+c+")</small>"))))}}];var y;(0,l.registerBlockType)("billy-blocks/invoice-table",{apiVersion:2,title:(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Invoice","billy"),(0,a.__)("Table","billy")),icon:"menu-alt",category:"billy-blocks",attributes:{currency:{type:"string",default:""},locale:{type:"string",default:""},amountSubtotal:{type:"number",default:""},amountTotal:{type:"number",default:""},taxRates:{type:"string",default:""},taxRatesTotal:{type:"number",default:""}},supports:{inserter:!1,reusable:!1,html:!1},getEditWrapperProps:()=>({"data-align":"wide"}),edit:(0,o.withSelect)(((e,{clientId:t})=>{const{getBlocksByClientId:l}=e("core/block-editor");return{childBlocks:l(t)[0].innerBlocks}}))((e=>{const{className:l,childBlocks:r,attributes:{currency:c,locale:o,amountSubtotal:b,amountTotal:p,taxRates:d,taxRatesTotal:_},setAttributes:E}=e,g=(0,n.useBlockProps)({className:"invoicetable-block"+(l?" "+l:"")});return y=()=>{var e=0,t=0,l=0,a=[],n=[];E({currency:globalDataBilly.currency}),E({locale:globalDataBilly.locale}),r&&r.length>0&&(r.map(((l,n)=>{e+=Number(l.attributes.amount),t+=Number(l.attributes.amount)+u(l.attributes.taxRate)*Number(l.attributes.amount),a.push({taxRate:l.attributes.taxRate,amount:u(l.attributes.taxRate)*Number(l.attributes.amount)})})),a.length>0&&(l=a.reduce((function(e,t){return e+t.amount}),0),l=Number(l.toFixed(2)),a.reduce((function(e,t){return e[t.taxRate]||(e[t.taxRate]={taxRate:t.taxRate,amount:0},n.push(e[t.taxRate])),e[t.taxRate].amount+=t.amount,e}),{})),E({taxRatesTotal:l}),E({taxRates:JSON.stringify(n)}),E({amountSubtotal:e}),E({amountTotal:t}))},(0,t.useEffect)((()=>{y()})),(0,i.createElement)("div",{...g},(0,i.createElement)(n.InspectorControls,null,(0,i.createElement)(s.PanelBody,{title:(0,a.__)("Actions","billy")},(0,i.createElement)("button",{id:"updatetotals",className:"components-button is-secondary is-button",onClick:y},(0,a.__)("Update Totals","billy")))),(0,i.createElement)(n.InnerBlocks,{templateLock:!1,template:[["billy-blocks/invoice-tablerow",{}]],allowedBlocks:["billy-blocks/invoice-tablerow"]}),b>0&&(0,i.createElement)("table",{className:"totals"},(0,i.createElement)("tbody",null,b>0&&(0,i.createElement)("tr",{className:"subtotal"},(0,i.createElement)("th",{style:{width:"50%"}},p>b?(0,a.__)("Subtotal","billy"):(0,a.__)("Total","billy")),(0,i.createElement)("td",null,(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),c,m(b,o)))),d&&_>0&&(0,i.createElement)("tr",{className:"taxRates"},(0,i.createElement)("th",{style:{width:"50%"}},(0,a.__)("Tax","billy")),(0,i.createElement)("td",null,JSON.parse(d).sort(((e,t)=>u(e.taxRate)-u(t.taxRate))).map(((e,l)=>{if(e.amount>0)return(0,i.createElement)(t.RawHTML,{key:l},(0,a.sprintf)((0,a.__)("%1$s %2$s %3$s","billy"),c,m(e.amount,o),"<small>("+e.taxRate+")</small><br>"))})))),p>b&&(0,i.createElement)("tr",{className:"total"},(0,i.createElement)("th",{style:{width:"50%"}},(0,a.__)("Total","billy")),(0,i.createElement)("td",null,(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),c,m(p,o)))))))})),save:e=>{const{className:l,attributes:{currency:s,locale:r,amountSubtotal:c,amountTotal:o,taxRates:b,taxRatesTotal:p}}=e,d=n.useBlockProps.save({className:"invoicetable-block alignwide"+(l?" "+l:"")});return(0,i.createElement)("div",{...d},(0,i.createElement)("table",{className:"table wp-block-table"},(0,i.createElement)("thead",null,(0,i.createElement)("tr",null,(0,i.createElement)("th",{scope:"col"},(0,a.__)("#","billy")),(0,i.createElement)("th",{scope:"col"},(0,a.__)("Description","billy")),(0,i.createElement)("th",{scope:"col"},(0,a.__)("Amount","billy")),b&&p>0&&(0,i.createElement)("th",{scope:"col"},(0,a.__)("Tax","billy")))),(0,i.createElement)("tbody",null,(0,i.createElement)(n.InnerBlocks.Content,null)),(0,i.createElement)("tfoot",null,c>0&&(0,i.createElement)("tr",{className:"subtotal"},(0,i.createElement)("th",{colSpan:"2"},o>c?(0,a.__)("Subtotal","billy"):(0,a.__)("Total","billy")),(0,i.createElement)("td",{colSpan:b&&p>0?"2":null},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(c,r)))),b&&p>0&&(0,i.createElement)("tr",{className:"taxrates"},(0,i.createElement)("th",{colSpan:"2"},(0,a.__)("Tax","billy")),(0,i.createElement)("td",{colSpan:b&&p>0?"2":null},JSON.parse(b).sort(((e,t)=>u(e.taxRate)-u(t.taxRate))).map(((e,l)=>{if(e.amount>0)return(0,i.createElement)(t.RawHTML,{key:l},(0,a.sprintf)((0,a.__)("%1$s %2$s %3$s","billy"),s,m(e.amount,r),"<small>("+e.taxRate+")</small><br>"))})))),o>c&&(0,i.createElement)("tr",{className:"total"},(0,i.createElement)("th",{colSpan:"2"},(0,a.__)("Total","billy")),(0,i.createElement)("td",{colSpan:b&&p>0?"2":null},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(o,r)))))))},deprecated:p}),(0,l.registerBlockType)("billy-blocks/invoice-tablerow",{apiVersion:2,title:(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Invoice","billy"),(0,a.__)("Table Row","billy")),icon:"menu-alt",category:"billy-blocks",parent:["billy-blocks/invoice-table"],attributes:{index:{type:"number",default:"0"},currency:{type:"string",default:""},locale:{type:"string",default:""},taxRate:{type:"string",default:""},amount:{type:"number",default:""},amountIncl:{type:"number",default:""},quantity:{type:"number",default:""},quantityRate:{type:"number",default:""}},getEditWrapperProps:()=>({"data-align":"wide"}),edit:(0,o.withSelect)(((e,{clientId:t})=>{const{getBlockRootClientId:l,getBlockIndex:a}=e("core/block-editor");return{i:a(t,l(t))+1}}))((e=>{const{i:l,attributes:{index:r,currency:c,locale:o,description:m,taxRate:b,amount:p,amountIncl:d,quantity:_,quantityRate:E},setAttributes:g}=e,f=(0,n.useBlockProps)();(0,t.useEffect)((()=>{g({index:l}),g({currency:globalDataBilly.currency}),g({locale:globalDataBilly.locale}),""===b&&g({taxRate:0===globalDataBilly.taxOptions.length?"0%":globalDataBilly.taxOptions[0].value})}));const x=e=>{g({amountIncl:e>0?Number(e):""}),y()},h=e=>{g({amount:e>0?Number(e):""}),x(Number(e)+Number(e)*u(b))};return(0,i.createElement)("div",{...f},(0,i.createElement)(n.InspectorControls,null,(0,i.createElement)(s.PanelBody,{title:(0,a.__)("Quantity/Rate Calculator","billy")},(0,i.createElement)(s.TextControl,{type:"number",label:(0,a.__)("Quantity","billy"),placeholder:(0,a.__)("0","billy"),value:_,onChange:e=>{g({quantity:e>0?Number(e):""}),h(Number(e)*Number(E))}}),(0,i.createElement)(s.TextControl,{type:"number",label:(0,a.sprintf)((0,a.__)("%1$s in %2$s","billy"),(0,a.__)("Rate","billy"),c),placeholder:(0,a.__)("0","billy"),value:E,onChange:e=>{g({quantityRate:e>0?Number(e):""}),h(Number(_)*Number(e))}}))),(0,i.createElement)("table",null,(0,i.createElement)("tbody",null,(0,i.createElement)("tr",null,(0,i.createElement)("th",{className:"index"},r&&r),(0,i.createElement)("td",{style:{width:"30vw",minWidth:"200px"}},(0,i.createElement)(n.InnerBlocks,{template:[["core/paragraph",{placeholder:(0,a.__)("Add content","billy"),content:m||""}]],allowedBlocks:["core/heading","core/paragraph","core/list","core/html"]})),(0,i.createElement)("td",null,(0,i.createElement)(s.TextControl,{type:"number",label:(0,a.sprintf)((0,a.__)("%1$s in %2$s","billy"),(0,a.__)("Amount","billy"),c),className:"amount",placeholder:(0,a.__)("0","billy"),value:p,onChange:h})),(0,i.createElement)("td",null,(0,i.createElement)(s.SelectControl,{className:"taxrate",label:(0,a.sprintf)((0,a.__)("%1$s in %2$s","billy"),(0,a.__)("Tax","billy"),"%"),value:b,options:0!==globalDataBilly.taxOptions.length?globalDataBilly.taxOptions:"0%"!==b&&0===globalDataBilly.taxOptions.length?[{label:b,value:b},{label:"0%",value:"0%"}]:"",onChange:e=>{g({taxRate:e}),x(Number(p)+Number(p)*u(e))}})),(0,i.createElement)("td",null,(0,i.createElement)(s.TextControl,{type:"number",disabled:"disabled",label:c,className:"amount-tax",placeholder:(0,a.__)("0","billy"),value:d}))))))})),save:e=>{const{attributes:{index:l,locale:s,taxRate:r,amount:c}}=e;return(0,i.createElement)("tr",null,(0,i.createElement)("th",{scope:"row"},l&&l),(0,i.createElement)("td",null,(0,i.createElement)(n.InnerBlocks.Content,null)),(0,i.createElement)("td",null,c&&m(c,s)),r&&u(r)*c>0&&(0,i.createElement)("td",null,(0,i.createElement)(t.RawHTML,null,(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),m(u(r)*c,s),"<small>("+r+")</small>"))))},deprecated:d}),(0,l.registerBlockType)("billy-blocks/quote-actions",{apiVersion:2,title:(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Quote","billy"),(0,a.__)("Actions","billy")),icon:"menu-alt",category:"billy-blocks",supports:{inserter:!1,reusable:!1,html:!1},getEditWrapperProps:()=>({"data-align":"wide"}),edit:(0,o.withSelect)((e=>({postModifiedDate:e("core/editor").getEditedPostAttribute("modified")})))((e=>{const{postModifiedDate:t}=e,l=(0,n.useBlockProps)({className:"components-placeholder",style:{minHeight:"auto"}});return(0,i.createElement)("div",{...l},(0,i.createElement)("small",null,(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Last modified","billy"),new Date(t).toLocaleString())))})),save:()=>null}),(0,l.registerBlockType)("billy-blocks/quote-meta",{apiVersion:2,title:(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Quote","billy"),(0,a.__)("Meta","billy")),icon:"editor-textcolor",category:"billy-blocks",attributes:{label:{type:"string",default:""},text:{type:"string",default:""}},supports:{inserter:!1,reusable:!1,html:!1},edit:e=>{const{attributes:{label:l,text:r},setAttributes:c}=e,o=(0,n.useBlockProps)();return(0,i.createElement)("div",{...o},(0,i.createElement)(n.InspectorControls,null,(0,i.createElement)(s.PanelBody,{title:(0,a.__)("Label","billy")},(0,i.createElement)(s.TextControl,{type:"text",className:"label",value:l,onChange:e=>{c({label:e})}})),(0,i.createElement)(s.PanelBody,{title:(0,a.__)("Text","billy")},(0,i.createElement)(s.TextControl,{type:"text",className:"text",value:r,onChange:e=>{c({text:e})}}))),(0,i.createElement)(t.RawHTML,null,(0,a.sprintf)((0,a.__)('<div class="label">%1$s</div> <div class="text">%2$s</div>',"billy"),l||"",r||(0,a.__)("N/A","billy"))))},save:e=>{const{attributes:{label:l,text:n}}=e;return n&&(0,i.createElement)(t.RawHTML,null,(0,a.sprintf)((0,a.__)('<div class="label">%1$s</div> <div class="text">%2$s</div>',"billy"),l||"",n||(0,a.__)("N/A","billy")))},deprecated:[{attributes:{label:{type:"string",default:""},text:{type:"string",default:""}},save:e=>{const{attributes:{label:l,text:n}}=e;return n&&(0,i.createElement)("p",null,(0,i.createElement)(t.RawHTML,null,(0,a.sprintf)("<p>"+(0,a.__)("<strong>%1$s</strong> <span>%2$s</span>","billy")+"</p>",l||"",n||(0,a.__)("N/A","billy"))))}}]}),(0,l.registerBlockType)("billy-blocks/quote-date",{apiVersion:2,title:(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Quote","billy"),(0,a.__)("Date","billy")),icon:"calendar-alt",category:"billy-blocks",supports:{inserter:!1,reusable:!1,html:!1},edit:()=>{const e=(0,n.useBlockProps)();return(0,i.createElement)("div",{...e},(0,i.createElement)(s.Disabled,null,(0,i.createElement)(c(),{block:"billy-blocks/quote-date"})))},save:()=>null}),(0,l.registerBlockType)("billy-blocks/quote-information",{apiVersion:2,title:(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Quote","billy"),(0,a.__)("Information","billy")),icon:"info",category:"billy-blocks",supports:{inserter:!1,reusable:!1,html:!1},edit:()=>{const e=(0,n.useBlockProps)();return(0,i.createElement)("div",{...e},(0,i.createElement)(n.InspectorControls,null,(0,i.createElement)(s.PanelBody,{title:(0,a.__)("Info","billy")},(0,i.createElement)("div",{className:"components-notice"},(0,i.createElement)("div",{className:"components-notice__content"},(0,a.sprintf)((0,a.__)("The %s values can be modified in the Theme Customizer.","billy"),(0,a.__)("Quote Information","billy")))))),(0,i.createElement)(c(),{block:"billy-blocks/quote-information"}))},save:()=>null});const _=[{attributes:{currency:{type:"string",default:""},locale:{type:"string",default:""},amountSubtotal:{type:"number",default:""},amountTotal:{type:"number",default:""},taxRates:{type:"string",default:""},taxRatesTotal:{type:"number",default:""}},save:e=>{const{className:l,attributes:{currency:s,locale:r,amountSubtotal:c,amountTotal:i,taxRates:o,taxRatesTotal:b}}=e;return(0,t.createElement)("div",{className:"quotetable-block alignwide"+(l?" "+l:"")},(0,t.createElement)("table",{className:"table wp-block-table"},(0,t.createElement)("thead",null,(0,t.createElement)("tr",null,(0,t.createElement)("th",{scope:"col"},(0,a.__)("#","billy")),(0,t.createElement)("th",{scope:"col"},(0,a.__)("Description","billy")),(0,t.createElement)("th",{scope:"col"},(0,a.__)("Amount","billy")),o&&b>0&&(0,t.createElement)("th",{scope:"col"},(0,a.__)("Tax","billy")))),(0,t.createElement)("tbody",null,(0,t.createElement)(n.InnerBlocks.Content,null)),(0,t.createElement)("tfoot",null,c>0&&(0,t.createElement)("tr",{className:"subtotal"},(0,t.createElement)("td",{colSpan:"2",className:"align-right"},i>c?(0,a.__)("Subtotal","billy"):(0,a.__)("Total","billy")),(0,t.createElement)("td",{colSpan:o&&b>0?"2":null},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(c,r)))),o&&b>0&&(0,t.createElement)("tr",{className:"taxrates"},(0,t.createElement)("td",{colSpan:"2",className:"align-right"},(0,a.__)("Tax","billy")),(0,t.createElement)("td",{colSpan:o&&b>0?"2":null},JSON.parse(o).sort(((e,t)=>u(e.taxRate)-u(t.taxRate))).map(((e,l)=>{if(e.amount>0)return(0,t.createElement)(t.RawHTML,{key:l},(0,a.sprintf)((0,a.__)("%1$s %2$s %3$s","billy"),s,m(e.amount,r),"<small>("+e.taxRate+")</small><br>"))})))),i>c&&(0,t.createElement)("tr",{className:"total"},(0,t.createElement)("td",{colSpan:"2",className:"align-right"},(0,a.__)("Total","billy")),(0,t.createElement)("td",{colSpan:o&&b>0?"2":null},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(i,r)))))))}},{attributes:{currency:{type:"string",default:""},locale:{type:"string",default:""},amountSubtotal:{type:"number",default:""},amountTotal:{type:"number",default:""},taxRates:{type:"string",default:""},taxRatesTotal:{type:"number",default:""}},save:e=>{const{className:l,attributes:{currency:s,locale:r,amountSubtotal:c,amountTotal:i,taxRates:o,taxRatesTotal:b}}=e;return(0,t.createElement)("div",{className:"quotetable-block alignwide"+(l?" "+l:"")},(0,t.createElement)("table",{className:"table wp-block-table"},(0,t.createElement)("thead",null,(0,t.createElement)("tr",null,(0,t.createElement)("th",{scope:"col"},(0,a.__)("#","billy")),(0,t.createElement)("th",{scope:"col"},(0,a.__)("Description","billy")),(0,t.createElement)("th",{scope:"col"},(0,a.__)("Amount","billy")),o&&b>0&&(0,t.createElement)("th",{scope:"col"},(0,a.__)("Tax","billy")))),(0,t.createElement)("tbody",null,(0,t.createElement)(n.InnerBlocks.Content,null)),(0,t.createElement)("tfoot",null,c>0&&(0,t.createElement)("tr",{className:"subtotal"},(0,t.createElement)("td",{colSpan:"2",align:"right"},i>c?(0,a.__)("Subtotal","billy"):(0,a.__)("Total","billy")),(0,t.createElement)("td",null,(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(c,r)))),o&&b>0&&(0,t.createElement)("tr",{className:"taxrates"},(0,t.createElement)("td",{colSpan:"2",align:"right"},(0,a.__)("Tax","billy")),(0,t.createElement)("td",null,JSON.parse(o).sort(((e,t)=>u(e.taxRate)-u(t.taxRate))).map(((e,l)=>{if(e.amount>0)return(0,t.createElement)(t.RawHTML,{key:l},(0,a.sprintf)((0,a.__)("%1$s %2$s %3$s","billy"),s,m(e.amount,r),"<small>("+e.taxRate+")</small><br>"))})))),i>c&&(0,t.createElement)("tr",{className:"total"},(0,t.createElement)("td",{colSpan:"2",align:"right"},(0,a.__)("Total","billy")),(0,t.createElement)("td",null,(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(i,r)))))))}}],E=[{attributes:{index:{type:"number",default:"0"},currency:{type:"string",default:""},locale:{type:"string",default:""},description:{type:"string",default:""},taxRate:{type:"string",default:""},amount:{type:"number",default:""},amountIncl:{type:"number",default:""},quantity:{type:"number",default:""},quantityRate:{type:"number",default:""}},save:e=>{const{className:l,attributes:{index:s,locale:r,taxRate:c,amount:o}}=e;return(0,i.createElement)("tr",null,(0,i.createElement)("th",{scope:"row"},s&&s),(0,i.createElement)("td",null,(0,i.createElement)(n.InnerBlocks.Content,null)),(0,i.createElement)("td",null,o&&m(o,r)),c&&u(c)*o>0&&(0,i.createElement)("td",null,(0,i.createElement)(t.RawHTML,null,(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),m(u(c)*o,r),"<small>("+c+")</small>"))))}},{attributes:{index:{type:"number",default:"0"},currency:{type:"string",default:""},locale:{type:"string",default:""},description:{type:"string",default:""},taxRate:{type:"string",default:""},amount:{type:"number",default:""},amountIncl:{type:"number",default:""},quantity:{type:"number",default:""},quantityRate:{type:"number",default:""}},save:e=>{const{className:l,attributes:{index:n,locale:s,description:r,taxRate:c,amount:o}}=e;return(0,i.createElement)("tr",null,(0,i.createElement)("th",{scope:"row"},n&&n),(0,i.createElement)("td",null,r&&(0,i.createElement)(t.RawHTML,null,r)),(0,i.createElement)("td",null,o&&m(o,s)),c&&u(c)*o>0&&(0,i.createElement)("td",null,(0,i.createElement)(t.RawHTML,null,(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),m(u(c)*o,s),"<small>("+c+")</small>"))))}}];var g;(0,l.registerBlockType)("billy-blocks/quote-table",{apiVersion:2,title:(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Quote","billy"),(0,a.__)("Table","billy")),icon:"menu-alt",category:"billy-blocks",attributes:{currency:{type:"string",default:""},locale:{type:"string",default:""},amountSubtotal:{type:"number",default:""},amountTotal:{type:"number",default:""},taxRates:{type:"string",default:""},taxRatesTotal:{type:"number",default:""}},supports:{inserter:!1,reusable:!1,html:!1},getEditWrapperProps:()=>({"data-align":"wide"}),edit:(0,o.withSelect)(((e,{clientId:t})=>{const{getBlocksByClientId:l}=e("core/block-editor");return{childBlocks:l(t)[0].innerBlocks}}))((e=>{const{className:l,childBlocks:r,attributes:{currency:c,locale:o,amountSubtotal:b,amountTotal:p,taxRates:d,taxRatesTotal:y},setAttributes:_}=e,E=(0,n.useBlockProps)({className:"quotetable-block"+(l?" "+l:"")});return g=()=>{var e=0,t=0,l=0,a=[],n=[];_({currency:globalDataBilly.currency}),_({locale:globalDataBilly.locale}),r&&r.length>0&&(r.map(((l,n)=>{e+=Number(l.attributes.amount),t+=Number(l.attributes.amount)+u(l.attributes.taxRate)*Number(l.attributes.amount),a.push({taxRate:l.attributes.taxRate,amount:u(l.attributes.taxRate)*Number(l.attributes.amount)})})),a.length>0&&(l=a.reduce((function(e,t){return e+t.amount}),0),l=Number(l.toFixed(2)),a.reduce((function(e,t){return e[t.taxRate]||(e[t.taxRate]={taxRate:t.taxRate,amount:0},n.push(e[t.taxRate])),e[t.taxRate].amount+=t.amount,e}),{})),_({taxRatesTotal:l}),_({taxRates:JSON.stringify(n)}),_({amountSubtotal:e}),_({amountTotal:t}))},(0,t.useEffect)((()=>{g()})),(0,i.createElement)("div",{...E},(0,i.createElement)(n.InspectorControls,null,(0,i.createElement)(s.PanelBody,{title:(0,a.__)("Actions","billy")},(0,i.createElement)("button",{id:"updatetotals",className:"components-button is-secondary is-button",onClick:g},(0,a.__)("Update Totals","billy")))),(0,i.createElement)(n.InnerBlocks,{templateLock:!1,template:[["billy-blocks/quote-tablerow",{}]],allowedBlocks:["billy-blocks/quote-tablerow"]}),b>0&&(0,i.createElement)("table",{className:"totals"},(0,i.createElement)("tbody",null,b>0&&(0,i.createElement)("tr",{className:"subtotal"},(0,i.createElement)("th",{style:{width:"50%"}},p>b?(0,a.__)("Subtotal","billy"):(0,a.__)("Total","billy")),(0,i.createElement)("td",null,(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),c,m(b,o)))),d&&y>0&&(0,i.createElement)("tr",{className:"taxRates"},(0,i.createElement)("th",{style:{width:"50%"}},(0,a.__)("Tax","billy")),(0,i.createElement)("td",null,JSON.parse(d).sort(((e,t)=>u(e.taxRate)-u(t.taxRate))).map(((e,l)=>{if(e.amount>0)return(0,i.createElement)(t.RawHTML,{key:l},(0,a.sprintf)((0,a.__)("%1$s %2$s %3$s","billy"),c,m(e.amount,o),"<small>("+e.taxRate+")</small><br>"))})))),p>b&&(0,i.createElement)("tr",{className:"total"},(0,i.createElement)("th",{style:{width:"50%"}},(0,a.__)("Total","billy")),(0,i.createElement)("td",null,(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),c,m(p,o)))))))})),save:e=>{const{className:l,attributes:{currency:s,locale:r,amountSubtotal:c,amountTotal:o,taxRates:b,taxRatesTotal:p}}=e,d=n.useBlockProps.save({className:"quotetable-block alignwide"+(l?" "+l:"")});return(0,i.createElement)("div",{...d},(0,i.createElement)("table",{className:"table wp-block-table"},(0,i.createElement)("thead",null,(0,i.createElement)("tr",null,(0,i.createElement)("th",{scope:"col"},(0,a.__)("#","billy")),(0,i.createElement)("th",{scope:"col"},(0,a.__)("Description","billy")),(0,i.createElement)("th",{scope:"col"},(0,a.__)("Amount","billy")),b&&p>0&&(0,i.createElement)("th",{scope:"col"},(0,a.__)("Tax","billy")))),(0,i.createElement)("tbody",null,(0,i.createElement)(n.InnerBlocks.Content,null)),(0,i.createElement)("tfoot",null,c>0&&(0,i.createElement)("tr",{className:"subtotal"},(0,i.createElement)("th",{colSpan:"2"},o>c?(0,a.__)("Subtotal","billy"):(0,a.__)("Total","billy")),(0,i.createElement)("td",{colSpan:b&&p>0?"2":null},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(c,r)))),b&&p>0&&(0,i.createElement)("tr",{className:"taxrates"},(0,i.createElement)("th",{colSpan:"2"},(0,a.__)("Tax","billy")),(0,i.createElement)("td",{colSpan:b&&p>0?"2":null},JSON.parse(b).sort(((e,t)=>u(e.taxRate)-u(t.taxRate))).map(((e,l)=>{if(e.amount>0)return(0,i.createElement)(t.RawHTML,{key:l},(0,a.sprintf)((0,a.__)("%1$s %2$s %3$s","billy"),s,m(e.amount,r),"<small>("+e.taxRate+")</small><br>"))})))),o>c&&(0,i.createElement)("tr",{className:"total"},(0,i.createElement)("th",{colSpan:"2"},(0,a.__)("Total","billy")),(0,i.createElement)("td",{colSpan:b&&p>0?"2":null},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(o,r)))))))},deprecated:_}),(0,l.registerBlockType)("billy-blocks/quote-tablerow",{apiVersion:2,title:(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Quote","billy"),(0,a.__)("Table Row","billy")),icon:"menu-alt",category:"billy-blocks",parent:["billy-blocks/quote-table"],attributes:{index:{type:"number",default:"0"},currency:{type:"string",default:""},locale:{type:"string",default:""},taxRate:{type:"string",default:""},amount:{type:"number",default:""},amountIncl:{type:"number",default:""},quantity:{type:"number",default:""},quantityRate:{type:"number",default:""}},getEditWrapperProps:()=>({"data-align":"wide"}),edit:(0,o.withSelect)(((e,{clientId:t})=>{const{getBlockRootClientId:l,getBlockIndex:a}=e("core/block-editor");return{i:a(t,l(t))+1}}))((e=>{const{i:l,attributes:{index:r,currency:c,locale:o,description:m,taxRate:b,amount:p,amountIncl:d,quantity:y,quantityRate:_},setAttributes:E}=e,f=(0,n.useBlockProps)();(0,t.useEffect)((()=>{E({index:l}),E({currency:globalDataBilly.currency}),E({locale:globalDataBilly.locale}),""===b&&E({taxRate:0===globalDataBilly.taxOptions.length?"0%":globalDataBilly.taxOptions[0].value})}));const x=e=>{E({amountIncl:e>0?Number(e):""}),g()},h=e=>{E({amount:e>0?Number(e):""}),x(Number(e)+Number(e)*u(b))};return(0,i.createElement)("div",{...f},(0,i.createElement)(n.InspectorControls,null,(0,i.createElement)(s.PanelBody,{title:(0,a.__)("Quantity/Rate Calculator","billy")},(0,i.createElement)(s.TextControl,{type:"number",label:(0,a.__)("Quantity","billy"),placeholder:(0,a.__)("0","billy"),value:y,onChange:e=>{E({quantity:e>0?Number(e):""}),h(Number(e)*Number(_))}}),(0,i.createElement)(s.TextControl,{type:"number",label:(0,a.sprintf)((0,a.__)("%1$s in %2$s","billy"),(0,a.__)("Rate","billy"),c),placeholder:(0,a.__)("0","billy"),value:_,onChange:e=>{E({quantityRate:e>0?Number(e):""}),h(Number(y)*Number(e))}}))),(0,i.createElement)("table",null,(0,i.createElement)("tbody",null,(0,i.createElement)("tr",null,(0,i.createElement)("th",{className:"index"},r&&r),(0,i.createElement)("td",{style:{width:"30vw",minWidth:"200px"}},(0,i.createElement)(n.InnerBlocks,{template:[["core/paragraph",{placeholder:(0,a.__)("Add content","billy"),content:m||""}]],allowedBlocks:["core/heading","core/paragraph","core/list","core/html"]})),(0,i.createElement)("td",null,(0,i.createElement)(s.TextControl,{type:"number",label:(0,a.sprintf)((0,a.__)("%1$s in %2$s","billy"),(0,a.__)("Amount","billy"),c),className:"amount",placeholder:(0,a.__)("0","billy"),value:p,onChange:h})),(0,i.createElement)("td",null,(0,i.createElement)(s.SelectControl,{className:"taxrate",label:(0,a.sprintf)((0,a.__)("%1$s in %2$s","billy"),(0,a.__)("Tax","billy"),"%"),value:b,options:0!==globalDataBilly.taxOptions.length?globalDataBilly.taxOptions:"0%"!==b&&0===globalDataBilly.taxOptions.length?[{label:b,value:b},{label:"0%",value:"0%"}]:"",onChange:e=>{E({taxRate:e}),x(Number(p)+Number(p)*u(e))}})),(0,i.createElement)("td",null,(0,i.createElement)(s.TextControl,{type:"number",disabled:"disabled",label:c,className:"amount-tax",placeholder:(0,a.__)("0","billy"),value:d}))))))})),save:e=>{const{attributes:{index:l,locale:s,taxRate:r,amount:c}}=e;return(0,i.createElement)("tr",null,(0,i.createElement)("th",{scope:"row"},l&&l),(0,i.createElement)("td",null,(0,i.createElement)(n.InnerBlocks.Content,null)),(0,i.createElement)("td",null,c&&m(c,s)),r&&u(r)*c>0&&(0,i.createElement)("td",null,(0,i.createElement)(t.RawHTML,null,(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),m(u(r)*c,s),"<small>("+r+")</small>"))))},deprecated:E}),(0,l.registerBlockType)("billy-blocks/quote-validuntildate",{apiVersion:2,title:(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Quote","billy"),(0,a.__)("Valid Until","billy")),icon:"calendar-alt",category:"billy-blocks",supports:{inserter:!1,reusable:!1,html:!1},edit:()=>{const e=(0,n.useBlockProps)();return(0,i.createElement)("div",{...e},(0,i.createElement)(s.Disabled,null,(0,i.createElement)(c(),{block:"billy-blocks/quote-validuntildate"})))},save:()=>null});const f=[{attributes:{currency:{type:"string",default:""},locale:{type:"string",default:""},amountTotalEarnings:{type:"number",default:""},amountTotalExpenses:{type:"number",default:""},amountTaxEarnings:{type:"number",default:""},amountTaxExpenses:{type:"number",default:""}},save:e=>{const{className:l,attributes:{currency:s,locale:r,amountTotalEarnings:c,amountTotalExpenses:i,amountTaxEarnings:o,amountTaxExpenses:u}}=e;return(0,t.createElement)("div",{className:"alignwide"+(l?" "+l:"")},(0,t.createElement)("table",{className:"table wp-block-table"},(0,t.createElement)("thead",null,(0,t.createElement)("tr",null,(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"index"},(0,a.__)("#","billy")),(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"date"},(0,a.__)("Date","billy")),(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"description"},(0,a.__)("Description","billy")),(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"reference"},(0,a.__)("Reference","billy")),(0,t.createElement)("th",{scope:"col",className:"sort earnings","data-sort":"earning"},(0,a.__)("Earnings","billy")),(0,t.createElement)("th",{scope:"col",className:"sort expenses","data-sort":"expense"},(0,a.__)("Expenses","billy")),(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"tax"},(0,a.__)("Taxes","billy")))),(0,t.createElement)("tbody",{className:"list"},(0,t.createElement)(n.InnerBlocks.Content,null)),(0,t.createElement)("tfoot",null,(c>0||i>0)&&(0,t.createElement)("tr",null,(0,t.createElement)("th",{colSpan:"5"},(0,a.sprintf)((0,a.__)("%1$s / %2$s","billy"),(0,a.__)("Earnings","billy"),(0,a.__)("Expenses","billy"))),(0,t.createElement)("td",{className:"sum earnings"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(c,r))),(0,t.createElement)("td",{className:"sum expenses"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(i,r)))),(c>0||i>0)&&(0,t.createElement)("tr",null,(0,t.createElement)("th",{colSpan:"5"},(0,a.__)("Profit","billy")),(0,t.createElement)("td",{colSpan:"2",className:"profit"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(c-i,r)))),(o>0||u>0)&&(0,t.createElement)("tr",null,(0,t.createElement)("th",{colSpan:"5"},(0,a.sprintf)((0,a.__)("%1$s (%2$s / %3$s)","billy"),(0,a.__)("Taxes","billy"),(0,a.__)("Earnings","billy"),(0,a.__)("Expenses","billy"))),(0,t.createElement)("td",{className:"sum tax-earnings"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(o,r))),(0,t.createElement)("td",{className:"sum tax-expenses"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(u,r)))))))}},{attributes:{currency:{type:"string",default:""},locale:{type:"string",default:""},amountTotalEarnings:{type:"number",default:""},amountTotalExpenses:{type:"number",default:""},amountTaxEarnings:{type:"number",default:""},amountTaxExpenses:{type:"number",default:""}},save:e=>{const{className:l,attributes:{currency:s,locale:r,amountTotalEarnings:c,amountTotalExpenses:i,amountTaxEarnings:o,amountTaxExpenses:u}}=e;return(0,t.createElement)("div",{className:"alignwide"+(l?" "+l:"")},(0,t.createElement)("table",{className:"table wp-block-table"},(0,t.createElement)("thead",null,(0,t.createElement)("tr",null,(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"index"},(0,a.__)("#","billy")),(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"date"},(0,a.__)("Date","billy")),(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"description"},(0,a.__)("Description","billy")),(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"reference"},(0,a.__)("Reference","billy")),(0,t.createElement)("th",{scope:"col",className:"sort earnings","data-sort":"earning"},(0,a.__)("Earnings","billy")),(0,t.createElement)("th",{scope:"col",className:"sort expenses","data-sort":"expense"},(0,a.__)("Expenses","billy")),(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"tax"},(0,a.__)("Taxes","billy")))),(0,t.createElement)("tbody",{className:"list"},(0,t.createElement)(n.InnerBlocks.Content,null)),(0,t.createElement)("tfoot",null,(c>0||i>0)&&(0,t.createElement)("tr",null,(0,t.createElement)("td",{colSpan:"5",className:"alignright"},(0,a.sprintf)((0,a.__)("%1$s / %2$s","billy"),(0,a.__)("Earnings","billy"),(0,a.__)("Expenses","billy"))),(0,t.createElement)("td",{className:"sum earnings"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(c,r))),(0,t.createElement)("td",{className:"sum expenses"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(i,r)))),(c>0||i>0)&&(0,t.createElement)("tr",null,(0,t.createElement)("td",{colSpan:"5",className:"alignright"},(0,a.__)("Profit","billy")),(0,t.createElement)("td",{colSpan:"2",className:"profit"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(c-i,r)))),(o>0||u>0)&&(0,t.createElement)("tr",null,(0,t.createElement)("td",{colSpan:"5",className:"alignright"},(0,a.sprintf)((0,a.__)("%1$s (%2$s / %3$s)","billy"),(0,a.__)("Taxes","billy"),(0,a.__)("Earnings","billy"),(0,a.__)("Expenses","billy"))),(0,t.createElement)("td",{className:"sum tax-earnings"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(o,r))),(0,t.createElement)("td",{className:"sum tax-expenses"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(u,r)))))))}},{attributes:{currency:{type:"string",default:""},locale:{type:"string",default:""},amountTotalEarnings:{type:"number",default:""},amountTotalExpenses:{type:"number",default:""},amountTaxEarnings:{type:"number",default:""},amountTaxExpenses:{type:"number",default:""}},save:e=>{const{className:l,attributes:{currency:s,locale:r,amountTotalEarnings:c,amountTotalExpenses:i,amountTaxEarnings:o,amountTaxExpenses:u}}=e;return(0,t.createElement)("div",{className:"alignwide"+(l?" "+l:"")},(0,t.createElement)("table",{className:"table wp-block-table"},(0,t.createElement)("thead",null,(0,t.createElement)("tr",null,(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"index"},(0,a.__)("#","billy")),(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"date"},(0,a.__)("Date","billy")),(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"description"},(0,a.__)("Description","billy")),(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"reference"},(0,a.__)("Reference","billy")),(0,t.createElement)("th",{scope:"col",className:"sort earnings","data-sort":"earning"},(0,a.__)("Earnings","billy")),(0,t.createElement)("th",{scope:"col",className:"sort expenses","data-sort":"expense"},(0,a.__)("Expenses","billy")),(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"tax"},(0,a.__)("Tax","billy")))),(0,t.createElement)("tbody",{className:"list"},(0,t.createElement)(n.InnerBlocks.Content,null)),(0,t.createElement)("tfoot",null,(c>0||i>0)&&(0,t.createElement)("tr",null,(0,t.createElement)("td",{colSpan:"4",align:"right"},(0,a.sprintf)((0,a.__)("%1$s / %2$s","billy"),(0,a.__)("Earnings","billy"),(0,a.__)("Expenses","billy"))),(0,t.createElement)("td",{className:"sum earnings"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(c,r))),(0,t.createElement)("td",{className:"sum expenses"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(i,r)))),(c>0||i>0)&&(0,t.createElement)("tr",null,(0,t.createElement)("td",{colSpan:"4",align:"right"},(0,a.__)("Profit","billy")),(0,t.createElement)("td",{colSpan:"2",className:"profit"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(c-i,r)))),(o>0||u>0)&&(0,t.createElement)("tr",null,(0,t.createElement)("td",{colSpan:"4",align:"right"},(0,a.sprintf)((0,a.__)("%1$s (%2$s / %3$s)","billy"),(0,a.__)("Taxes","billy"),(0,a.__)("Earnings","billy"),(0,a.__)("Expenses","billy"))),(0,t.createElement)("td",{className:"sum tax-earnings"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(o,r))),(0,t.createElement)("td",{className:"sum tax-expenses"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(u,r)))))))}},{attributes:{currency:{type:"string",default:""},locale:{type:"string",default:""},amountTotalEarnings:{type:"number",default:""},amountTotalExpenses:{type:"number",default:""},amountTaxEarnings:{type:"number",default:""},amountTaxExpenses:{type:"number",default:""}},save:e=>{const{className:l,attributes:{currency:s,locale:r,amountTotalEarnings:c,amountTotalExpenses:i,amountTaxEarnings:o,amountTaxExpenses:u}}=e;return(0,t.createElement)("div",{className:"alignwide"+(l?" "+l:"")},(0,t.createElement)("table",{className:"table wp-block-table"},(0,t.createElement)("thead",null,(0,t.createElement)("tr",null,(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"index"},(0,a.__)("#","billy")),(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"date"},(0,a.__)("Date","billy")),(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"description"},(0,a.__)("Description","billy")),(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"reference"},(0,a.__)("Reference","billy")),(0,t.createElement)("th",{scope:"col",className:"sort earnings","data-sort":"earning"},(0,a.__)("Earning","billy")),(0,t.createElement)("th",{scope:"col",className:"sort expenses","data-sort":"expense"},(0,a.__)("Expense","billy")),(0,t.createElement)("th",{scope:"col",className:"sort","data-sort":"tax"},(0,a.__)("Tax","billy")))),(0,t.createElement)("tbody",{className:"list"},(0,t.createElement)(n.InnerBlocks.Content,null)),(0,t.createElement)("tfoot",null,(c>0||i>0)&&(0,t.createElement)("tr",null,(0,t.createElement)("td",{colSpan:"4",align:"right"},(0,a.sprintf)((0,a.__)("%1$s / %2$s","billy"),(0,a.__)("Earnings","billy"),(0,a.__)("Expenses","billy"))),(0,t.createElement)("td",{className:"sum earnings"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(c,r))),(0,t.createElement)("td",{className:"sum expenses"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(i,r)))),(c>0||i>0)&&(0,t.createElement)("tr",null,(0,t.createElement)("td",{colSpan:"4",align:"right"},(0,a.__)("Profit","billy")),(0,t.createElement)("td",{colSpan:"2",className:"profit"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(c-i,r)))),(o>0||u>0)&&(0,t.createElement)("tr",null,(0,t.createElement)("td",{colSpan:"4",align:"right"},(0,a.sprintf)((0,a.__)("%1$s (%2$s / %3$s)","billy"),(0,a.__)("Taxes","billy"),(0,a.__)("Earnings","billy"),(0,a.__)("Expenses","billy"))),(0,t.createElement)("td",{className:"sum tax-earnings"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(o,r))),(0,t.createElement)("td",{className:"sum tax-expenses"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),s,m(u,r)))))))}}],x=[{attributes:{index:{type:"number",default:"0"},currency:{type:"string",default:""},locale:{type:"string",default:""},date:{type:"string",default:""},quarter:{type:"number",default:""},reference:{type:"string",default:""},earning:{type:"number",default:""},expense:{type:"number",default:""},tax:{type:"number",default:""},postUUID:{type:"string",default:""},postTitle:{type:"string",default:""},postLink:{type:"string",default:""},postType:{type:"string",default:""}},save:e=>{const{className:t,attributes:{index:l,locale:s,date:r,quarter:c,earning:o,expense:u,tax:b,reference:p,postLink:d}}=e;return(0,i.createElement)("tr",{"data-date":r&&new Date(r).toISOString().substring(0,10),"data-quarter":c&&(0,a.sprintf)((0,a.__)("Q%s","billy"),c),"data-reference":p&&p,"data-earning":o>0?o:null,"data-expense":u>0?u:null,"data-tax":b>0?b:null},(0,i.createElement)("th",{className:"index",scope:"row"},l&&l),(0,i.createElement)("td",{className:"date","data-value":r&&new Date(r).toISOString().substring(0,10)},r&&new Date(r).toISOString().substring(0,10),(0,i.createElement)("sub",null,c&&(0,a.sprintf)((0,a.__)("Q%s","billy"),c))),(0,i.createElement)("td",{className:"description"},(0,i.createElement)(n.InnerBlocks.Content,null)),(0,i.createElement)("td",{className:"reference"},p&&!d&&p,p&&d&&(0,i.createElement)("a",{href:d},p)),(0,i.createElement)("td",{className:"amount earning","data-value":o>0?o:null},o&&o>0&&m(o,s)),(0,i.createElement)("td",{className:"amount expense","data-value":u>0?u:null},u&&u>0&&m(u,s)),b&&b>0&&(0,i.createElement)("td",{className:"amount tax","data-value":b},m(b,s)))}},{attributes:{index:{type:"number",default:"0"},currency:{type:"string",default:""},locale:{type:"string",default:""},date:{type:"string",default:""},quarter:{type:"number",default:""},reference:{type:"string",default:""},earning:{type:"number",default:""},expense:{type:"number",default:""},tax:{type:"number",default:""},postUUID:{type:"string",default:""},postTitle:{type:"string",default:""},postLink:{type:"string",default:""},postType:{type:"string",default:""}},save:e=>{const{className:t,attributes:{index:l,locale:s,date:r,quarter:c,earning:o,expense:u,tax:b,reference:p,postLink:d}}=e;return(0,i.createElement)("tr",{"data-date":r&&new Date(r).toISOString().substring(0,10),"data-quarter":c&&(0,a.sprintf)((0,a.__)("Q%s","billy"),c),"data-reference":p&&p,"data-earning":o>0?o:null,"data-expense":u>0?u:null,"data-tax":b>0?b:null},(0,i.createElement)("th",{className:"index",scope:"row"},l&&l),(0,i.createElement)("td",{className:"date","data-value":r&&new Date(r).toISOString().substring(0,10)},r&&new Date(r).toISOString().substring(0,10),(0,i.createElement)("sub",null,c&&(0,a.sprintf)((0,a.__)("Q%s","billy"),c))),(0,i.createElement)("td",{className:"description"},(0,i.createElement)(n.InnerBlocks.Content,null)),(0,i.createElement)("td",{className:"reference"},p&&!d&&p,p&&d&&(0,i.createElement)("a",{href:d},p)),(0,i.createElement)("td",{className:"amount earning","data-value":o>0?o:null},o&&o>0&&m(o,s)),(0,i.createElement)("td",{className:"amount expense","data-value":u>0?u:null},u&&u>0&&m(u,s)),(0,i.createElement)("td",{className:"amount tax","data-value":b>0?b:null},b&&b>0&&m(b,s)))}},{attributes:{index:{type:"number",default:"0"},currency:{type:"string",default:""},locale:{type:"string",default:""},date:{type:"string",default:""},quarter:{type:"number",default:""},reference:{type:"string",default:""},description:{type:"string",default:""},earning:{type:"number",default:""},expense:{type:"number",default:""},tax:{type:"number",default:""},postUUID:{type:"string",default:""},postTitle:{type:"string",default:""},postLink:{type:"string",default:""},postType:{type:"string",default:""}},save:e=>{const{className:t,attributes:{index:l,locale:n,date:s,quarter:r,description:c,earning:o,expense:u,tax:b,reference:p,postLink:d}}=e;return(0,i.createElement)("tr",{"data-date":s&&new Date(s).toISOString().substring(0,10),"data-quarter":r&&(0,a.sprintf)((0,a.__)("Q%s","billy"),r),"data-reference":p&&p,"data-earning":o>0?o:null,"data-expense":u>0?u:null,"data-tax":b>0?b:null},(0,i.createElement)("th",{className:"index",scope:"row"},l&&l),(0,i.createElement)("td",{className:"date","data-value":s&&new Date(s).toISOString().substring(0,10)},s&&new Date(s).toISOString().substring(0,10),(0,i.createElement)("sub",null,r&&(0,a.sprintf)((0,a.__)("Q%s","billy"),r))),(0,i.createElement)("td",{className:"description"},c&&c),(0,i.createElement)("td",{className:"reference"},p&&!d&&p,p&&d&&(0,i.createElement)("a",{href:d},p)),(0,i.createElement)("td",{className:"amount earning","data-value":o>0?o:null},o&&o>0&&m(o,n)),(0,i.createElement)("td",{className:"amount expense","data-value":u>0?u:null},u&&u>0&&m(u,n)),(0,i.createElement)("td",{className:"amount tax","data-value":b>0?b:null},b&&b>0&&m(b,n)))}}];var h;(0,l.registerBlockType)("billy-blocks/accounting-table",{apiVersion:2,title:(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Accounting","billy"),(0,a.__)("Table","billy")),icon:"menu-alt",category:"billy-blocks",attributes:{currency:{type:"string",default:""},locale:{type:"string",default:""},amountTotalEarnings:{type:"number",default:""},amountTotalExpenses:{type:"number",default:""},amountTaxEarnings:{type:"number",default:""},amountTaxExpenses:{type:"number",default:""}},supports:{inserter:!1,reusable:!1,html:!1},getEditWrapperProps:()=>({"data-align":"wide"}),edit:(0,o.withSelect)(((e,{clientId:t})=>{const{getBlocksByClientId:l}=e("core/block-editor"),a=l(t)[0].innerBlocks;return a.sort(((e,t)=>new Date(e.attributes.date)-new Date(t.attributes.date))),{childBlocks:a}}))((e=>{const{className:l,childBlocks:r,attributes:{currency:c,locale:o,amountTotalEarnings:u,amountTotalExpenses:b,amountTaxEarnings:p,amountTaxExpenses:d},setAttributes:y}=e,_=(0,n.useBlockProps)({className:"accountingtable-block"+(l?" "+l:"")});return h=()=>{var e=0,t=0,l=0,a=0;y({currency:globalDataBilly.currency}),y({locale:globalDataBilly.locale}),r&&r.length>0&&r.forEach((n=>{e+=Number(n.attributes.earning),t+=Number(n.attributes.expense),n.attributes.earning&&(l+=Number(n.attributes.tax)),n.attributes.expense&&(a+=Number(n.attributes.tax))})),y({amountTotalEarnings:e}),y({amountTotalExpenses:t}),y({amountTaxEarnings:l}),y({amountTaxExpenses:a})},(0,t.useEffect)((()=>{h()})),(0,i.createElement)("div",{..._},(0,i.createElement)(n.InspectorControls,null,(0,i.createElement)(s.PanelBody,{title:(0,a.__)("Actions","billy")},(0,i.createElement)("button",{id:"updatetotals",className:"components-button is-secondary is-button",onClick:h},(0,a.__)("Update Totals","billy")))),(0,i.createElement)(n.InnerBlocks,{templateLock:!1,template:[["billy-blocks/accounting-tablerow",{}]],allowedBlocks:["billy-blocks/accounting-tablerow"]}),(0,i.createElement)("table",{className:"totals"},(0,i.createElement)("tbody",null,u>0&&(0,i.createElement)("tr",{className:"earnings"},(0,i.createElement)("th",{style:{width:"50%"}},(0,a.__)("Earnings","billy")),(0,i.createElement)("td",null,(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),c,m(u,o)))),b>0&&(0,i.createElement)("tr",{className:"expenses"},(0,i.createElement)("th",{style:{width:"50%"}},(0,a.__)("Expenses","billy")),(0,i.createElement)("td",null,(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),c,m(b,o)))),(u>0||b>0)&&(0,i.createElement)("tr",{className:"profit"},(0,i.createElement)("th",{style:{width:"50%"}},(0,a.__)("Profit","billy")),(0,i.createElement)("td",{style:{borderTop:"2px solid"}},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),c,m(u-b,o)))),(0,i.createElement)(i.Fragment,null,(0,i.createElement)("tr",{className:"taxes-earnings"},(0,i.createElement)("th",{style:{width:"50%"}},(0,a.sprintf)((0,a.__)("Taxes (%s)","billy"),(0,a.__)("Earnings","billy"))),(0,i.createElement)("td",null,(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),c,m(p,o)))),(0,i.createElement)("tr",{className:"taxes-expenses"},(0,i.createElement)("th",{style:{width:"50%"}},(0,a.sprintf)((0,a.__)("Taxes (%s)","billy"),(0,a.__)("Expenses","billy"))),(0,i.createElement)("td",null,(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),c,m(d,o))))))))})),save:e=>{const{className:t,attributes:{currency:l,locale:s,amountTotalEarnings:r,amountTotalExpenses:c,amountTaxEarnings:o,amountTaxExpenses:u}}=e,b=n.useBlockProps.save({className:"alignwide"+(t?" "+t:"")});return(0,i.createElement)("div",{...b},(0,i.createElement)("table",{className:"table wp-block-table"},(0,i.createElement)("thead",null,(0,i.createElement)("tr",null,(0,i.createElement)("th",{scope:"col",className:"sort","data-sort":"index"},(0,a.__)("#","billy")),(0,i.createElement)("th",{scope:"col",className:"sort","data-sort":"date"},(0,a.__)("Date","billy")),(0,i.createElement)("th",{scope:"col",className:"sort","data-sort":"description"},(0,a.__)("Description","billy")),(0,i.createElement)("th",{scope:"col",className:"sort","data-sort":"reference"},(0,a.__)("Reference","billy")),(0,i.createElement)("th",{scope:"col",className:"sort earnings","data-sort":"earning"},(0,a.__)("Earnings","billy")),(0,i.createElement)("th",{scope:"col",className:"sort expenses","data-sort":"expense"},(0,a.__)("Expenses","billy")),(o>0||u>0)&&(0,i.createElement)("th",{scope:"col",className:"sort","data-sort":"tax"},(0,a.__)("Taxes","billy")))),(0,i.createElement)("tbody",{className:"list"},(0,i.createElement)(n.InnerBlocks.Content,null)),(0,i.createElement)("tfoot",null,(r>0||c>0)&&(0,i.createElement)("tr",null,(0,i.createElement)("th",{colSpan:"4"},(0,a.sprintf)((0,a.__)("%1$s / %2$s","billy"),(0,a.__)("Earnings","billy"),(0,a.__)("Expenses","billy"))),(0,i.createElement)("td",{className:"sum earnings"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),l,m(r,s))),(0,i.createElement)("td",{className:"sum expenses"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),l,m(c,s)))),(r>0||c>0)&&(0,i.createElement)("tr",null,(0,i.createElement)("th",{colSpan:"4"},(0,a.__)("Profit","billy")),(0,i.createElement)("td",{colSpan:"2",className:"profit"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),l,m(r-c,s)))),(o>0||u>0)&&(0,i.createElement)("tr",null,(0,i.createElement)("th",{colSpan:"4"},(0,a.sprintf)((0,a.__)("%1$s (%2$s / %3$s)","billy"),(0,a.__)("Taxes","billy"),(0,a.__)("Earnings","billy"),(0,a.__)("Expenses","billy"))),(0,i.createElement)("td",{className:"sum tax-earnings"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),l,m(o,s))),(0,i.createElement)("td",{className:"sum tax-expenses"},(0,a.sprintf)((0,a.__)("%1$s %2$s","billy"),l,m(u,s)))))))},deprecated:f}),(0,l.registerBlockType)("billy-blocks/accounting-tablerow",{apiVersion:2,title:(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Accounting","billy"),(0,a.__)("Table Row","billy")),icon:"menu-alt",category:"billy-blocks",parent:["billy-blocks/accounting-table"],attributes:{index:{type:"number",default:"0"},currency:{type:"string",default:""},locale:{type:"string",default:""},date:{type:"string",default:""},quarter:{type:"number",default:""},reference:{type:"string",default:""},earning:{type:"number",default:""},expense:{type:"number",default:""},tax:{type:"number",default:""},postUUID:{type:"string",default:""},postTitle:{type:"string",default:""},postLink:{type:"string",default:""},postType:{type:"string",default:""}},getEditWrapperProps:()=>({"data-align":"wide"}),edit:(0,o.withSelect)(((e,{clientId:t})=>{const{getBlockRootClientId:l,getBlockIndex:a}=e("core/block-editor");return{clientId:t,rootClientId:l(t),i:a(t,l(t))+1}}))((e=>{const{clientId:l,rootClientId:r,i:c,attributes:{index:m,currency:u,locale:p,description:d,date:y,quarter:_,earning:E,expense:g,tax:f,reference:x,postUUID:N,postTitle:$,postLink:k,postType:T},setAttributes:v}=e;return(0,t.useEffect)((()=>{v({index:c}),v({currency:globalDataBilly.currency}),v({locale:globalDataBilly.locale}),""===y&&(v({date:(new Date).toISOString().substring(0,10)}),v({quarter:b((new Date).toISOString().substring(0,10))}))})),(0,i.createElement)(i.Fragment,null,(0,i.createElement)(n.InspectorControls,null,!N&&(0,i.createElement)(s.PanelBody,{title:(0,a.__)("Date","billy")},(0,i.createElement)(s.DatePicker,{currentDate:y,onChange:e=>{v({date:e}),(e=>{v({quarter:Number(b(e))})})(e),(0,o.dispatch)("core/block-editor").moveBlockToPosition(l,r,r,c)}})),N&&k&&(0,i.createElement)(s.PanelBody,{title:(0,a.sprintf)((0,a.__)("Reference: %s","billy"),T?T.charAt(0).toUpperCase()+T.substring(1):(0,a.__)("Post","billy"))},(0,i.createElement)("p",null,(0,i.createElement)("a",{href:k},$||k)))),(0,i.createElement)("table",null,(0,i.createElement)("tbody",null,(0,i.createElement)("tr",null,(0,i.createElement)("th",{className:"index"},m&&m),(0,i.createElement)("td",{className:"date"},y&&new Date(y).toISOString().substring(0,10),(0,i.createElement)("sub",null,_&&(0,a.sprintf)((0,a.__)("Q%s","billy"),_))),(0,i.createElement)("td",{className:"description",style:{minWidth:"200px"}},(0,i.createElement)(n.InnerBlocks,{template:[["core/paragraph",{placeholder:(0,a.__)("Add content","billy"),content:d||""}]],allowedBlocks:["core/heading","core/paragraph","core/list","core/html"]})),(0,i.createElement)("td",{className:"reference"},(0,i.createElement)(s.TextControl,{type:"text",label:(0,a.__)("Reference","billy"),placeholder:"",value:x,onChange:e=>{v({reference:e})}})),(0,i.createElement)("td",{className:"amount earning"},(0,i.createElement)(s.TextControl,{type:"number",label:(0,a.sprintf)((0,a.__)("%1$s in %2$s","billy"),(0,a.__)("Earning","billy"),u),placeholder:(0,a.__)("0","billy"),value:E,onChange:e=>{v({expense:""}),v({earning:e>0?Number(e):""}),h()}})),(0,i.createElement)("td",{className:"amount expense"},(0,i.createElement)(s.TextControl,{type:"number",label:(0,a.sprintf)((0,a.__)("%1$s in %2$s","billy"),(0,a.__)("Expense","billy"),u),placeholder:(0,a.__)("0","billy"),value:g,onChange:e=>{v({earning:""}),v({expense:e>0?Number(e):""}),h()}})),(0,i.createElement)("td",{className:"amount tax"},(0,i.createElement)(s.TextControl,{type:"number",label:(0,a.sprintf)((0,a.__)("%1$s in %2$s","billy"),(0,a.__)("Tax","billy"),u),placeholder:(0,a.__)("0","billy"),value:f,onChange:e=>{v({tax:e>0?Number(e):""}),h()}}))))))})),save:e=>{const{attributes:{index:t,locale:l,date:s,quarter:r,earning:c,expense:o,tax:u,reference:b,postLink:p}}=e;return(0,i.createElement)("tr",{"data-date":s&&new Date(s).toISOString().substring(0,10),"data-quarter":r&&(0,a.sprintf)((0,a.__)("Q%s","billy"),r),"data-reference":b&&b,"data-earning":c>0?c:null,"data-expense":o>0?o:null,"data-tax":u>0?u:null},(0,i.createElement)("th",{className:"index",scope:"row"},t&&t),(0,i.createElement)("td",{className:"date","data-value":s&&new Date(s).toISOString().substring(0,10)},s&&new Date(s).toISOString().substring(0,10),(0,i.createElement)("sub",null,r&&(0,a.sprintf)((0,a.__)("Q%s","billy"),r))),(0,i.createElement)("td",{className:"description"},(0,i.createElement)(n.InnerBlocks.Content,null)),(0,i.createElement)("td",{className:"reference"},b&&!p&&b,b&&p&&(0,i.createElement)("a",{href:p},b)),(0,i.createElement)("td",{className:"amount earning","data-value":c>0?c:null},c&&c>0&&m(c,l)),(0,i.createElement)("td",{className:"amount expense","data-value":o>0?o:null},o&&o>0&&m(o,l)),u&&u>0&&(0,i.createElement)("td",{className:"amount tax","data-value":u},m(u,l)))},deprecated:x}),(0,l.registerBlockType)("billy-blocks/accounting-actions",{apiVersion:2,title:(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Accounting","billy"),(0,a.__)("Actions","billy")),icon:"menu-alt",category:"billy-blocks",supports:{inserter:!1,reusable:!1,html:!1},getEditWrapperProps:()=>({"data-align":"wide"}),edit:(0,o.withSelect)((e=>({postModifiedDate:e("core/editor").getEditedPostAttribute("modified")})))((e=>{const{postModifiedDate:t}=e,l=(0,n.useBlockProps)({className:"components-placeholder",style:{minHeight:"auto"}});return(0,i.createElement)("div",{...l},(0,i.createElement)("small",null,(0,a.sprintf)((0,a.__)("%1$s: %2$s","billy"),(0,a.__)("Last modified","billy"),new Date(t).toLocaleString())))})),save:()=>null});const N=window.wp.plugins,$=window.wp.editPost;(0,N.registerPlugin)("billy-setup",{render:()=>(0,i.createElement)($.PluginDocumentSettingPanel,{name:"billy-setup",title:(0,a.__)("Billy Setup","billy"),className:"my-document-setting-plugin"},(0,i.createElement)("p",null,(0,i.createElement)("a",{href:globalDataBilly.wpAdmin+"customize.php?autofocus[panel]=billy_setup_panel"},(0,a.__)("Settings (Theme Customizer)","billy"))),(0,i.createElement)("ul",{className:"ul code"},(0,i.createElement)("li",{title:(0,a.__)("Invoice number","billy")},(0,i.createElement)(c(),{block:"billy-blocks/invoice-number"})),(0,i.createElement)("li",{title:(0,a.__)("Name","billy")},(0,i.createElement)(c(),{block:"billy-blocks/theme-mod",attributes:{themeMod:"name"}})),(0,i.createElement)("li",{title:(0,a.__)("Address","billy")},(0,i.createElement)(c(),{block:"billy-blocks/theme-mod",attributes:{themeMod:"address"}})),(0,i.createElement)("li",{title:(0,a.__)("VAT","billy")},(0,i.createElement)(c(),{block:"billy-blocks/theme-mod",attributes:{themeMod:"vat"}})),(0,i.createElement)("li",{title:(0,a.__)("Currency","billy")},(0,i.createElement)(c(),{block:"billy-blocks/theme-mod",attributes:{themeMod:"currency"}})),(0,i.createElement)("li",{title:(0,a.__)("Taxes","billy")},(0,i.createElement)(c(),{block:"billy-blocks/theme-mod",attributes:{themeMod:"taxrates"}}))))}),(0,l.registerBlockType)("billy-blocks/theme-mod",{apiVersion:2,title:(0,a.__)("Theme Mod","billy"),icon:"admin-generic",category:"billy-blocks",attributes:{themeMod:{type:"string",default:""}},supports:{inserter:!1,reusable:!1,html:!1},edit:e=>{const{attributes:{themeMod:t},setAttributes:l}=e,r=(0,n.useBlockProps)();return(0,i.createElement)("div",{...r},(0,i.createElement)(n.InspectorControls,null,(0,i.createElement)(s.PanelBody,{title:(0,a.__)("Theme Mod","billy")},(0,i.createElement)(s.SelectControl,{label:(0,a.__)("Setting","billy"),help:(0,a.__)("Modify the value in the Theme Customizer.","billy"),options:globalDataBilly.themeModOptions,value:t,onChange:e=>{l({themeMod:e})}}))),(0,i.createElement)(s.Disabled,null,(0,i.createElement)(c(),{block:"billy-blocks/theme-mod",attributes:e.attributes})))},save:()=>null})})();
     1(()=>{"use strict";var e={n:t=>{var l=t&&t.__esModule?()=>t.default:()=>t;return e.d(l,{a:l}),l},d:(t,l)=>{for(var a in l)e.o(l,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:l[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window..createElement)(c(),{block:"billy-blocks/theme-mod",attributes:e.attributes})))},save:()=>null})})();
  • billy/trunk/readme.txt

    r3016777 r3018666  
    55Requires at least: 5.6
    66Tested up to: 6.4
    7 Stable tag: 1.7.0
     7Stable tag: 1.7.
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    140140== Changelog ==
    141141
     142
     143
     144
     145
    142146= 1.7.0 =
    143147* Code refactoring with an upgrade to Block API v2
  • billy/trunk/vendor/composer/installed.php

    r3016777 r3018666  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '03f4eeccaec0987022989ede5db37c9a0a815250',
     6        'reference' => '',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '03f4eeccaec0987022989ede5db37c9a0a815250',
     16            'reference' => '',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.