170 lines
7.6 KiB
PHP
170 lines
7.6 KiB
PHP
<?php
|
|
|
|
namespace WPDesk\FlexibleInvoicesPro\Addons\Sending;
|
|
|
|
use WPDesk\FlexibleInvoicesPro\Addons\Sending\Fields\MultipleInputTextField;
|
|
use WPDesk\FlexibleInvoicesPro\Addons\Sending\Fields\WysiwygField;
|
|
use WPDeskWCInvoicesVendor\WPDesk\Forms\Field\CheckboxField;
|
|
use WPDeskWCInvoicesVendor\WPDesk\Forms\Field\Header;
|
|
use WPDeskWCInvoicesVendor\WPDesk\Forms\Field\InputTextField;
|
|
use WPDeskWCInvoicesVendor\WPDesk\Forms\Field\SelectField;
|
|
use WPDeskWCInvoicesVendor\WPDesk\Forms\Field\SubmitField;
|
|
use WPDeskWCInvoicesVendor\WPDesk\Library\FlexibleInvoicesCore\Settings\Tabs\FieldSettingsTab;
|
|
|
|
class SendingTab extends FieldSettingsTab {
|
|
|
|
const TAX_NAME = 'name';
|
|
const TAX_RATE = 'rate';
|
|
|
|
/**
|
|
* Get disabled data value.
|
|
*
|
|
* @return string
|
|
*/
|
|
private function get_disabled(): string {
|
|
return 'yes';
|
|
}
|
|
|
|
/**
|
|
* Field definition.
|
|
*
|
|
* @return array
|
|
*/
|
|
protected function get_fields(): array {
|
|
$pro_url = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/sklep/faktury-woocommerce-zaawansowana-wysylka/?utm_source=wp-admin-plugins&utm_medium=button&utm_campaign=flexible-invoices-adavanced-sending' : 'https://flexibleinvoices.com/products/advanced-sending-for-flexible-invoices/?utm_source=wp-admin-plugins&utm_medium=button&utm_campaign=flexible-invoices-advanced-sending';
|
|
|
|
return [
|
|
( new Header() )
|
|
->set_name( '' )
|
|
->set_description( sprintf( '<a target="_blank" href="%1$s" >%2$s</a>', $pro_url, esc_html__( 'To automate emails with invoices to your accountant buy the add-on Advanced Sending for Flexible Invoices →', 'flexible-invoices-woocommerce' ) ) )
|
|
->set_label( __( 'Sending invoices', 'flexible-invoices-woocommerce' ) )
|
|
->set_disabled(),
|
|
( new CheckboxField() )
|
|
->set_name( '' )
|
|
->set_label( __( 'Sending invoices to customers', 'flexible-invoices-woocommerce' ) )
|
|
->set_default_value( 'on' )
|
|
->set_sublabel( __( 'Enable automatic mailing of invoices to customers', 'flexible-invoices-woocommerce' ) )
|
|
->set_disabled(),
|
|
( new CheckboxField() )
|
|
->set_name( '' )
|
|
->set_label( __( 'Attachments in the e-mail', 'flexible-invoices-woocommerce' ) )
|
|
->set_sublabel( __( 'Attach PDF file to invoice email', 'flexible-invoices-woocommerce' ) )
|
|
->set_disabled(),
|
|
( new Header() )
|
|
->set_name( '' )
|
|
->set_label( __( 'Cyclical sending of invoices', 'flexible-invoices-woocommerce' ) )
|
|
->set_description( __( 'Below you will set up a cyclical sending of ZIP files with invoices. You can find out more in the <a href="https://wpde.sk/fi-sending-docs" target="_blank" rel="nofollow, noopener">plugins docs</a>.', 'flexible-invoices-woocommerce' ) )
|
|
->set_disabled(),
|
|
( new MultipleInputTextField() )
|
|
->set_name( '' )
|
|
->set_label( __( 'Additional recipients', 'flexible-invoices-woocommerce' ) )
|
|
->set_placeholder( __( 'E-mail address', 'flexible-invoices-woocommerce' ) )
|
|
->set_description( __( 'Add additional recipients', 'flexible-invoices-woocommerce' ) )
|
|
->set_disabled(),
|
|
( new SelectField() )
|
|
->set_label( __( 'Schedule for sending documents', 'flexible-invoices-woocommerce' ) )
|
|
->set_name( '' )
|
|
->set_description( __( 'Choose the period for which you want sent documents to the address from the "Additional Recipients" setting.', 'flexible-invoices-woocommerce' ) )
|
|
->set_options(
|
|
[
|
|
'none' => __( 'none', 'flexible-invoices-woocommerce' ),
|
|
'daily' => __( 'daily', 'flexible-invoices-woocommerce' ),
|
|
'weekly' => __( 'weekly', 'flexible-invoices-woocommerce' ),
|
|
'monthly' => __( 'monthly', 'flexible-invoices-woocommerce' ),
|
|
]
|
|
)
|
|
->set_default_value( 'none' )
|
|
->set_disabled(),
|
|
( new InputTextField() )
|
|
->set_name( '' )
|
|
->set_label( __( 'Email subject', 'flexible-invoices-woocommerce' ) )
|
|
->set_placeholder( __( 'Invoices from {from_date} to {to_date}', 'flexible-invoices-woocommerce' ) )
|
|
->set_default_value( EmailStrings::get_email_invoice_subject() )
|
|
->set_description( __( 'You can use the following shortcodes: {site_title}, {site_url}, {admin_email}, {current_date}, {site_description}, {from_date}, {to_date}.', 'flexible-invoices-woocommerce' ) )
|
|
->set_disabled(),
|
|
( new WysiwygField() )
|
|
->set_name( '' )
|
|
->set_label( __( 'E-mail body', 'flexible-invoices-woocommerce' ) )
|
|
->set_default_value( EmailStrings::get_email_invoice_body() )
|
|
->set_description( __( 'You can use the following shortcodes: {site_title}, {site_url}, {admin_email}, {current_date}, {site_description}, {from_date}, {to_date}.', 'flexible-invoices-woocommerce' ) )
|
|
->set_disabled(),
|
|
|
|
( new Header() )
|
|
->set_name( '' )
|
|
->set_label( __( 'Cyclical sending of reports', 'flexible-invoices-woocommerce' ) )
|
|
->set_description( __( 'Below you will set up a cyclical sending of reports. You can find out more in the <a href="https://wpde.sk/fi-sending-docs" target="_blank" rel="nofollow, noopener">plugins docs</a>.', 'flexible-invoices-woocommerce' ) )
|
|
->set_disabled(),
|
|
( new MultipleInputTextField() )
|
|
->set_name( '' )
|
|
->set_label( __( 'Additional recipients', 'flexible-invoices-woocommerce' ) )
|
|
->set_placeholder( __( 'E-mail address', 'flexible-invoices-woocommerce' ) )
|
|
->set_description( __( 'Add additional recipients.', 'flexible-invoices-woocommerce' ) )
|
|
->set_attribute( 'data-disabled', $this->get_disabled() )
|
|
->set_disabled(),
|
|
( new SelectField() )
|
|
->set_label( __( 'Schedule for sending reports', 'flexible-invoices-woocommerce' ) )
|
|
->set_name( '' )
|
|
->set_description( __( 'Choose the period for which you want the report automatically sent to the address from the "Additional Recipients" setting.', 'flexible-invoices-woocommerce' ) )
|
|
->set_options(
|
|
[
|
|
'none' => __( 'none', 'flexible-invoices-woocommerce' ),
|
|
'daily' => __( 'daily', 'flexible-invoices-woocommerce' ),
|
|
'weekly' => __( 'weekly', 'flexible-invoices-woocommerce' ),
|
|
'monthly' => __( 'monthly', 'flexible-invoices-woocommerce' ),
|
|
]
|
|
)
|
|
->set_default_value( 'none' )
|
|
->set_attribute( 'data-disabled', $this->get_disabled() )
|
|
->set_disabled(),
|
|
( new InputTextField() )
|
|
->set_name( '' )
|
|
->set_label( __( 'Email subject', 'flexible-invoices-woocommerce' ) )
|
|
->set_placeholder( __( 'Report from {from_date} to {to_date} ', 'flexible-invoices-woocommerce' ) )
|
|
->set_default_value( EmailStrings::get_email_report_subject() )
|
|
->set_description( __( 'You can use the following shortcodes: {site_title}, {site_url}, {admin_email}, {current_date}, {site_description}, {from_date}, {to_date}.', 'flexible-invoices-woocommerce' ) )
|
|
->set_attribute( 'data-disabled', $this->get_disabled() )
|
|
->set_disabled(),
|
|
( new WysiwygField() )
|
|
->set_name( '' )
|
|
->set_label( __( 'E-mail body', 'flexible-invoices-woocommerce' ) )
|
|
->set_description( __( 'You can use the following shortcodes: {site_title}, {site_url}, {admin_email}, {current_date}, {site_description}, {from_date}, {to_date}.', 'flexible-invoices-woocommerce' ) )
|
|
->set_default_value( EmailStrings::get_email_report_body() )
|
|
->set_attribute( 'data-disabled', $this->get_disabled() )
|
|
->set_disabled(),
|
|
( new SubmitField() )
|
|
->set_name( '' )
|
|
->set_label( __( 'Save changes', 'flexible-invoices-woocommerce' ) )
|
|
->add_class( 'button-primary' )
|
|
->set_disabled(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get tab slug.
|
|
*
|
|
* @return string
|
|
*/
|
|
public static function get_tab_slug(): string {
|
|
return 'fias-sending';
|
|
}
|
|
|
|
/**
|
|
* Get tab name.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function get_tab_name(): string {
|
|
return __( 'Advanced Sending', 'flexible-invoices-woocommerce' );
|
|
}
|
|
|
|
/**
|
|
* Is active.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public static function is_active(): bool {
|
|
return true;
|
|
}
|
|
|
|
}
|