Add draft status filters for recurring invoices
This commit is contained in:
parent
bb39f8e687
commit
e50a3e692d
|
|
@ -86,12 +86,15 @@ class RecurringInvoiceFilters extends QueryFilters
|
|||
}
|
||||
|
||||
$recurring_filters = [];
|
||||
|
||||
if (in_array('draft', $status_parameters)) {
|
||||
$recurring_filters[] = RecurringInvoice::STATUS_DRAFT;
|
||||
}
|
||||
|
||||
if (in_array('active', $status_parameters)) {
|
||||
$recurring_filters[] = RecurringInvoice::STATUS_ACTIVE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (in_array('paused', $status_parameters)) {
|
||||
$recurring_filters[] = RecurringInvoice::STATUS_PAUSED;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ class MapSettings extends AbstractService
|
|||
"client_manual_payment_notification" => "manual_payment_email",
|
||||
"send_email_on_mark_paid" => "mark_paid_payment_email",
|
||||
"auto_bill_standard_invoices" => "auto_bill_standard_invoices",
|
||||
"client_portal_enable_uploads" => "client_document_upload",
|
||||
"vendor_portal_enable_uploads" => "vendor_document_upload",
|
||||
"accept_client_input_quote_approval" => "accept_purchase_order_number",
|
||||
];
|
||||
|
||||
public function __construct(private Client $client)
|
||||
|
|
@ -50,19 +53,6 @@ class MapSettings extends AbstractService
|
|||
|
||||
public function run()
|
||||
{
|
||||
|
||||
|
||||
// $merged_settings = $this->client->getMergedSettings();
|
||||
|
||||
// // Extract only the settings we want from merged settings
|
||||
// $default_settings = [];
|
||||
|
||||
// foreach ($this->default_settings as $key) {
|
||||
// if (isset($merged_settings->{$key})) {
|
||||
// $default_settings[$key] = $merged_settings->{$key};
|
||||
// }
|
||||
// }
|
||||
|
||||
$settings_map = [];
|
||||
$group_only_settings = [];
|
||||
$client_settings = (array)$this->client->settings;
|
||||
|
|
@ -72,30 +62,14 @@ class MapSettings extends AbstractService
|
|||
$group_only_settings = array_diff_key($group_settings, $client_settings);
|
||||
}
|
||||
|
||||
$group = collect($group_only_settings)->mapWithKeys(function($value, $key) {
|
||||
|
||||
if($key == "company_gateway_ids") {
|
||||
$key = "company_gateways";
|
||||
$value = $this->handleCompanyGateways($value);
|
||||
}
|
||||
|
||||
return [$this->getTranslationFromKey($key) => $value];
|
||||
})->toArray();
|
||||
$group = $this->mapSettings($group_only_settings);
|
||||
|
||||
unset($client_settings['entity']);
|
||||
unset($client_settings['industry_id']);
|
||||
unset($client_settings['size_id']);
|
||||
unset($client_settings['currency_id']);
|
||||
|
||||
$client = collect($client_settings)->mapWithKeys(function($value, $key) {
|
||||
|
||||
if ($key == "company_gateway_ids") {
|
||||
$key = "company_gateways";
|
||||
$value = $this->handleCompanyGateways($value);
|
||||
}
|
||||
|
||||
return [$this->getTranslationFromKey($key) => $value];
|
||||
})->toArray();
|
||||
$client = $this->mapSettings($client_settings);
|
||||
|
||||
return [
|
||||
'group_settings' => $group,
|
||||
|
|
@ -104,6 +78,30 @@ class MapSettings extends AbstractService
|
|||
|
||||
}
|
||||
|
||||
private function mapSettings(array $settings): array
|
||||
{
|
||||
|
||||
return collect($settings)->mapWithKeys(function ($value, $key) {
|
||||
|
||||
if ($key == "company_gateway_ids") {
|
||||
$key = "company_gateways";
|
||||
$value = $this->handleCompanyGateways($value);
|
||||
}
|
||||
|
||||
if ($key == "language_id") {
|
||||
$value = $this->handleLanguage($value);
|
||||
}
|
||||
|
||||
return [$this->getTranslationFromKey($key) => $value];
|
||||
})->toArray();
|
||||
|
||||
}
|
||||
private function handleLanguage(string $language_id): string
|
||||
{
|
||||
$language = app('languages')->firstWhere('id', $language_id);
|
||||
return $language->name;
|
||||
}
|
||||
|
||||
private function getTranslationFromKey(string $key): string
|
||||
{
|
||||
if(isset($this->default_settings[$key])) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue