diff --git a/app/Abstracts/View/Components/DocumentForm.php b/app/Abstracts/View/Components/DocumentForm.php index 7f42c8a18..bc34ff9c1 100644 --- a/app/Abstracts/View/Components/DocumentForm.php +++ b/app/Abstracts/View/Components/DocumentForm.php @@ -176,7 +176,7 @@ abstract class DocumentForm extends Component bool $hideLogo = false, bool $hideDocumentTitle = false, bool $hideDocumentSubheading = false, bool $hideCompanyEdit = false, /** Company Component End */ /** Content Component Start */ - string $formRoute = '', string $formId = 'document', string $formSubmit = 'onSubmit', + string $formRoute = '', string $formId = 'document', string $formSubmit = 'onSubmit', bool $hideCompany = false, bool $hideAdvanced = false, bool $hideFooter = false, bool $hideButtons = false, /** Content Component End */ /** Metadata Component Start */ @@ -323,16 +323,14 @@ abstract class DocumentForm extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $contact_type = 'customer'; - break; case 'bill': case 'expense': case 'purchase': $contact_type = 'vendor'; break; + default: + $contact_type = 'customer'; + break; } return $contact_type; @@ -349,16 +347,14 @@ abstract class DocumentForm extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $issued_at = request()->get('invoiced_at', Date::now()->toDateString()); - break; case 'bill': case 'expense': case 'purchase': $issued_at = request()->get('billed_at', Date::now()->toDateString()); break; + default: + $issued_at = request()->get('invoiced_at', Date::now()->toDateString()); + break; } return $issued_at; @@ -375,16 +371,14 @@ abstract class DocumentForm extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $document_number = $this->getNextDocumentNumber(Document::INVOICE_TYPE); - break; case 'bill': case 'expense': case 'purchase': $document_number = $this->getNextDocumentNumber(Document::BILL_TYPE); break; + default: + $document_number = $this->getNextDocumentNumber(Document::INVOICE_TYPE); + break; } return $document_number; @@ -401,16 +395,14 @@ abstract class DocumentForm extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $due_at = Date::parse(request()->get('invoiced_at', Date::now()->toDateString()))->addDays(setting('invoice.payment_terms', 0))->toDateString(); - break; case 'bill': case 'expense': case 'purchase': $due_at = request()->get('billed_at', Date::now()->toDateString()); break; + default: + $due_at = Date::parse(request()->get('invoiced_at', Date::now()->toDateString()))->addDays(setting('invoice.payment_terms', 0))->toDateString(); + break; } return $due_at; @@ -436,16 +428,14 @@ abstract class DocumentForm extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textDocumentNumber = 'invoices.invoice_number'; - break; case 'bill': case 'expense': case 'purchase': $textDocumentNumber = 'bills.bill_number'; break; + default: + $textDocumentNumber = 'invoices.invoice_number'; + break; } return $textDocumentNumber; @@ -458,16 +448,14 @@ abstract class DocumentForm extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textOrderNumber = 'invoices.order_number'; - break; case 'bill': case 'expense': case 'purchase': $textOrderNumber = 'bills.order_number'; break; + default: + $textOrderNumber = 'invoices.order_number'; + break; } return $textOrderNumber; @@ -480,16 +468,14 @@ abstract class DocumentForm extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textIssuedAt = 'invoices.invoice_date'; - break; case 'bill': case 'expense': case 'purchase': $textIssuedAt = 'bills.bill_date'; break; + default: + $textIssuedAt = 'invoices.invoice_date'; + break; } return $textIssuedAt; @@ -502,16 +488,14 @@ abstract class DocumentForm extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textDueAt = 'invoices.due_date'; - break; case 'bill': case 'expense': case 'purchase': $textDueAt = 'bills.due_date'; break; + default: + $textDueAt = 'invoices.due_date'; + break; } return $textDueAt; @@ -524,20 +508,18 @@ abstract class DocumentForm extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': + case 'bill': + case 'expense': + case 'purchase': + $text_items = 'general.items'; + break; + default: $text_items = setting('invoice.item_name', 'general.items'); if ($text_items == 'custom') { $text_items = setting('invoice.item_name_input'); } break; - case 'bill': - case 'expense': - case 'purchase': - $text_items = 'general.items'; - break; } return $text_items; @@ -550,20 +532,18 @@ abstract class DocumentForm extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': + case 'bill': + case 'expense': + case 'purchase': + $text_quantity = 'bills.quantity'; + break; + default: $text_quantity = setting('invoice.quantity_name', 'invoices.quantity'); if ($text_quantity == 'custom') { $text_quantity = setting('invoice.quantity_name_input'); } break; - case 'bill': - case 'expense': - case 'purchase': - $text_quantity = 'bills.quantity'; - break; } return $text_quantity; @@ -576,20 +556,18 @@ abstract class DocumentForm extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': + case 'bill': + case 'expense': + case 'purchase': + $text_price = 'bills.price'; + break; + default: $text_price = setting('invoice.price_name', 'invoices.price'); if ($text_price == 'custom') { $text_price = setting('invoice.price_name_input'); } break; - case 'bill': - case 'expense': - case 'purchase': - $text_price = 'bills.price'; - break; } return $text_price; @@ -601,16 +579,7 @@ abstract class DocumentForm extends Component return $text_amount; } - switch ($type) { - case 'sale': - case 'income': - case 'invoice': - case 'bill': - case 'expense': - case 'purchase': - $text_amount = 'general.amount'; - break; - } + $text_amount = 'general.amount'; return $text_amount; } @@ -633,16 +602,14 @@ abstract class DocumentForm extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $hideName = setting('invoice.hide_item_name', $hideName); - break; case 'bill': case 'expense': case 'purchase': $hideName = setting('bill.hide_item_name', $hideName); break; + default: + $hideName = setting('invoice.hide_item_name', $hideName); + break; } return $hideName; @@ -655,16 +622,14 @@ abstract class DocumentForm extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $hideDescription = setting('invoice.hide_item_description', $hideDescription); - break; case 'bill': case 'expense': case 'purchase': $hideDescription = setting('bill.hide_item_description', $hideDescription); break; + default: + $hideDescription = setting('invoice.hide_item_description', $hideDescription); + break; } return $hideDescription; @@ -677,16 +642,14 @@ abstract class DocumentForm extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $hideQuantity = setting('invoice.hide_quantity', $hideQuantity); - break; case 'bill': case 'expense': case 'purchase': $hideQuantity = setting('bill.hide_quantity', $hideQuantity); break; + default: + $hideQuantity = setting('invoice.hide_quantity', $hideQuantity); + break; } return $hideQuantity; @@ -699,16 +662,14 @@ abstract class DocumentForm extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $hidePrice = setting('invoice.hide_price', $hidePrice); - break; case 'bill': case 'expense': case 'purchase': $hidePrice = setting('bill.hide_price', $hidePrice); break; + default: + $hidePrice = setting('invoice.hide_price', $hidePrice); + break; } return $hidePrice; @@ -721,16 +682,14 @@ abstract class DocumentForm extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $hideDiscount = setting('invoice.hide_discount', $hideDiscount); - break; case 'bill': case 'expense': case 'purchase': $hideDiscount = setting('bill.hide_discount', $hideDiscount); break; + default: + $hideDiscount = setting('invoice.hide_discount', $hideDiscount); + break; } return $hideDiscount; @@ -743,16 +702,14 @@ abstract class DocumentForm extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $hideAmount = setting('invoice.hide_amount', $hideAmount); - break; case 'bill': case 'expense': case 'purchase': $hideAmount = setting('bill.hide_amount', $hideAmount); break; + default: + $hideAmount = setting('invoice.hide_amount', $hideAmount); + break; } return $hideAmount; diff --git a/app/Abstracts/View/Components/DocumentIndex.php b/app/Abstracts/View/Components/DocumentIndex.php index bc2f9ffad..b736f2c40 100644 --- a/app/Abstracts/View/Components/DocumentIndex.php +++ b/app/Abstracts/View/Components/DocumentIndex.php @@ -545,16 +545,14 @@ abstract class DocumentIndex extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textContactName = 'general.customers'; - break; case 'bill': case 'expense': case 'purchase': $textContactName = 'general.vendors'; break; + default: + $textContactName = 'general.customers'; + break; } return $textContactName; @@ -593,16 +591,14 @@ abstract class DocumentIndex extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textIssueAt = 'invoices.invoice_date'; - break; case 'bill': case 'expense': case 'purchase': $textIssueAt = 'bills.bill_date'; break; + default: + $textIssueAt = 'invoices.invoice_date'; + break; } return $textIssueAt; @@ -628,16 +624,14 @@ abstract class DocumentIndex extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textDueAt = 'invoices.due_date'; - break; case 'bill': case 'expense': case 'purchase': $textDueAt = 'bills.due_date'; break; + default: + $textDueAt = 'invoices.due_date'; + break; } return $textDueAt; @@ -663,16 +657,14 @@ abstract class DocumentIndex extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textDocumentStatus = 'invoices.statuses.'; - break; case 'bill': case 'expense': case 'purchase': $textDocumentStatus = 'bills.statuses.'; break; + default: + $textDocumentStatus = 'invoices.statuses.'; + break; } return $textDocumentStatus; diff --git a/app/Abstracts/View/Components/DocumentShow.php b/app/Abstracts/View/Components/DocumentShow.php index 585b89481..0915fa5b5 100644 --- a/app/Abstracts/View/Components/DocumentShow.php +++ b/app/Abstracts/View/Components/DocumentShow.php @@ -102,7 +102,7 @@ abstract class DocumentShow extends Component /** @var string */ public $permissionButtonCustomize; - + /** @var bool */ public $hideButtonGroupDivider1; @@ -316,7 +316,7 @@ abstract class DocumentShow extends Component public $hidePrice; public $hideDiscount; - + public $hideAmount; /** @var string */ @@ -512,16 +512,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textRecurringType = 'general.invoices'; - break; case 'bill': case 'expense': case 'purchase': $textRecurringType = 'general.bills'; break; + default: + $textRecurringType = 'general.invoices'; + break; } return $textRecurringType; @@ -534,16 +532,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textStatusMessage = 'invoices.messages.draft'; - break; case 'bill': case 'expense': case 'purchase': $textStatusMessage = 'bills.messages.draft'; break; + default: + $textStatusMessage = 'invoices.messages.draft'; + break; } return $textStatusMessage; @@ -629,16 +625,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textHistories = 'invoices.histories'; - break; case 'bill': case 'expense': case 'purchase': $textHistories = 'bills.histories'; break; + default: + $textHistories = 'invoices.histories'; + break; } return $textHistories; @@ -651,16 +645,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textHistoryStatus = 'invoices.statuses.'; - break; case 'bill': case 'expense': case 'purchase': $textHistoryStatus = 'bills.statuses.'; break; + default: + $textHistoryStatus = 'invoices.statuses.'; + break; } return $textHistoryStatus; @@ -1013,16 +1005,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textHeaderContact = 'general.customers'; - break; case 'bill': case 'expense': case 'purchase': $textHeaderContact = 'general.vendors'; break; + default: + $textHeaderContact = 'general.customers'; + break; } return $textHeaderContact; @@ -1088,16 +1078,7 @@ abstract class DocumentShow extends Component return $hideTimelineStatuses; } - switch ($type) { - case 'sale': - case 'income': - case 'invoice': - case 'bill': - case 'expense': - case 'purchase': - $hideTimelineStatuses = ['paid', 'cancelled']; - break; - } + $hideTimelineStatuses = ['paid', 'cancelled']; return $hideTimelineStatuses; } @@ -1127,16 +1108,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textTimelineSentTitle = 'invoices.send_invoice'; - break; case 'bill': case 'expense': case 'purchase': $textTimelineSentTitle = 'bills.receive_bill'; break; + default: + $textTimelineSentTitle = 'invoices.send_invoice'; + break; } return $textTimelineSentTitle; @@ -1149,16 +1128,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textTimelineSentStatusDraft = 'invoices.messages.status.send.draft'; - break; case 'bill': case 'expense': case 'purchase': $textTimelineSentStatusDraft = 'bills.messages.status.receive.draft'; break; + default: + $textTimelineSentStatusDraft = 'invoices.messages.status.send.draft'; + break; } return $textTimelineSentStatusDraft; @@ -1171,16 +1148,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textTimelineSentStatusMarkSent = 'invoices.mark_sent'; - break; case 'bill': case 'expense': case 'purchase': $textTimelineSentStatusMarkSent = 'bills.mark_received'; break; + default: + $textTimelineSentStatusMarkSent = 'invoices.mark_sent'; + break; } return $textTimelineSentStatusMarkSent; @@ -1193,16 +1168,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textTimelineSentStatusReceived = 'invoices.mark_sent'; - break; case 'bill': case 'expense': case 'purchase': $textTimelineSentStatusReceived = 'bills.mark_received'; break; + default: + $textTimelineSentStatusReceived = 'invoices.mark_sent'; + break; } return $textTimelineSentStatusReceived; @@ -1215,14 +1188,12 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textTimelineSendStatusMail = 'invoices.send_mail'; - break; case 'bill': case 'expense': case 'purchase': + $textTimelineSendStatusMail = 'bills.send_mail'; + break; + default: $textTimelineSendStatusMail = 'invoices.send_mail'; break; } @@ -1237,16 +1208,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textTimelineGetPaidTitle = 'invoices.get_paid'; - break; case 'bill': case 'expense': case 'purchase': $textTimelineGetPaidTitle = 'bills.make_payment'; break; + default: + $textTimelineGetPaidTitle = 'invoices.get_paid'; + break; } return $textTimelineGetPaidTitle; @@ -1259,16 +1228,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textTimelineGetPaidStatusAwait = 'invoices.messages.status.paid.await'; - break; case 'bill': case 'expense': case 'purchase': $textTimelineGetPaidStatusAwait = 'bills.messages.status.paid.await'; break; + default: + $textTimelineGetPaidStatusAwait = 'invoices.messages.status.paid.await'; + break; } return $textTimelineGetPaidStatusAwait; @@ -1292,16 +1259,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textTimelineGetPaidMarkPaid = 'invoices.mark_paid'; - break; case 'bill': case 'expense': case 'purchase': $textTimelineGetPaidMarkPaid = 'bills.mark_paid'; break; + default: + $textTimelineGetPaidMarkPaid = 'invoices.mark_paid'; + break; } return $textTimelineGetPaidMarkPaid; @@ -1314,16 +1279,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textTimelineGetPaidAddPayment = 'invoices.add_payment'; - break; case 'bill': case 'expense': case 'purchase': $textTimelineGetPaidAddPayment = 'bills.add_payment'; break; + default: + $textTimelineGetPaidAddPayment = 'invoices.add_payment'; + break; } return $textTimelineGetPaidAddPayment; @@ -1347,16 +1310,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $hideName = setting('invoice.hide_item_name', $hideName); - break; case 'bill': case 'expense': case 'purchase': $hideName = setting('bill.hide_item_name', $hideName); break; + default: + $hideName = setting('invoice.hide_item_name', $hideName); + break; } return $hideName; @@ -1369,16 +1330,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $hideDescription = setting('invoice.hide_item_description', $hideDescription); - break; case 'bill': case 'expense': case 'purchase': $hideDescription = setting('bill.hide_item_description', $hideDescription); break; + default: + $hideDescription = setting('invoice.hide_item_description', $hideDescription); + break; } return $hideDescription; @@ -1391,16 +1350,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $hideQuantity = setting('invoice.hide_quantity', $hideQuantity); - break; case 'bill': case 'expense': case 'purchase': $hideQuantity = setting('bill.hide_quantity', $hideQuantity); break; + default: + $hideQuantity = setting('invoice.hide_quantity', $hideQuantity); + break; } return $hideQuantity; @@ -1413,16 +1370,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $hidePrice = setting('invoice.hide_price', $hidePrice); - break; case 'bill': case 'expense': case 'purchase': $hidePrice = setting('bill.hide_price', $hidePrice); break; + default: + $hidePrice = setting('invoice.hide_price', $hidePrice); + break; } return $hidePrice; @@ -1435,16 +1390,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $hideDiscount = setting('invoice.hide_discount', $hideDiscount); - break; case 'bill': case 'expense': case 'purchase': $hideDiscount = setting('bill.hide_discount', $hideDiscount); break; + default: + $hideDiscount = setting('invoice.hide_discount', $hideDiscount); + break; } return $hideDiscount; @@ -1457,16 +1410,14 @@ abstract class DocumentShow extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $hideAmount = setting('invoice.hide_amount', $hideAmount); - break; case 'bill': case 'expense': case 'purchase': $hideAmount = setting('bill.hide_amount', $hideAmount); break; + default: + $hideAmount = setting('invoice.hide_amount', $hideAmount); + break; } return $hideAmount; diff --git a/app/Abstracts/View/Components/DocumentTemplate.php b/app/Abstracts/View/Components/DocumentTemplate.php index c148f669e..682ee38b6 100644 --- a/app/Abstracts/View/Components/DocumentTemplate.php +++ b/app/Abstracts/View/Components/DocumentTemplate.php @@ -146,7 +146,7 @@ abstract class DocumentTemplate extends Component $this->hideDueAt = $hideDueAt; $this->textContactInfo = $this->getTextContactInfo($type, $textContactInfo); - $this->textIssuedAt = $this->gettextIssuedAt($type, $textIssuedAt); + $this->textIssuedAt = $this->getTextIssuedAt($type, $textIssuedAt); $this->textDocumentNumber = $this->getTextDocumentNumber($type, $textDocumentNumber); $this->textDueAt = $this->getTextDueAt($type, $textDueAt); $this->textOrderNumber = $this->getTextOrderNumber($type, $textOrderNumber); @@ -229,16 +229,14 @@ abstract class DocumentTemplate extends Component $backgroundColor = '#55588b'; switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $backgroundColor = setting('invoice.color'); - break; case 'bill': case 'expense': case 'purchase': $backgroundColor = setting('bill.color'); break; + default: + $backgroundColor = setting('invoice.color'); + break; } return $backgroundColor; @@ -251,16 +249,14 @@ abstract class DocumentTemplate extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textDocumentNumber = 'invoices.invoice_number'; - break; case 'bill': case 'expense': case 'purchase': $textDocumentNumber = 'bills.bill_number'; break; + default: + $textDocumentNumber = 'invoices.invoice_number'; + break; } return $textDocumentNumber; @@ -273,16 +269,14 @@ abstract class DocumentTemplate extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textOrderNumber = 'invoices.order_number'; - break; case 'bill': case 'expense': case 'purchase': $textOrderNumber = 'bills.order_number'; break; + default: + $textOrderNumber = 'invoices.order_number'; + break; } return $textOrderNumber; @@ -295,38 +289,34 @@ abstract class DocumentTemplate extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textContactInfo = 'invoices.bill_to'; - break; case 'bill': case 'expense': case 'purchase': $textContactInfo = 'bills.bill_from'; break; + default: + $textContactInfo = 'invoices.bill_to'; + break; } return $textContactInfo; } - protected function gettextIssuedAt($type, $textIssuedAt) + protected function getTextIssuedAt($type, $textIssuedAt) { if (!empty($textIssuedAt)) { return $textIssuedAt; } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textIssuedAt = 'invoices.invoice_date'; - break; case 'bill': case 'expense': case 'purchase': $textIssuedAt = 'bills.bill_date'; break; + default: + $textIssuedAt = 'invoices.invoice_date'; + break; } return $textIssuedAt; @@ -339,16 +329,14 @@ abstract class DocumentTemplate extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $textDueAt = 'invoices.due_date'; - break; case 'bill': case 'expense': case 'purchase': $textDueAt = 'bills.due_date'; break; + default: + $textDueAt = 'invoices.due_date'; + break; } return $textDueAt; @@ -361,20 +349,18 @@ abstract class DocumentTemplate extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': + case 'bill': + case 'expense': + case 'purchase': + $textItems = 'general.items'; + break; + default: $textItems = setting('invoice.item_name', 'general.items'); if ($textItems == 'custom') { $textItems = setting('invoice.item_name_input'); } break; - case 'bill': - case 'expense': - case 'purchase': - $textItems = 'general.items'; - break; } return $textItems; @@ -387,20 +373,18 @@ abstract class DocumentTemplate extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': + case 'bill': + case 'expense': + case 'purchase': + $textQuantity = 'bills.quantity'; + break; + default: $textQuantity = setting('invoice.quantity_name', 'invoices.quantity'); if ($textQuantity == 'custom') { $textQuantity = setting('invoice.quantity_name_input'); } break; - case 'bill': - case 'expense': - case 'purchase': - $textQuantity = 'bills.quantity'; - break; } return $textQuantity; @@ -413,20 +397,18 @@ abstract class DocumentTemplate extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': + case 'bill': + case 'expense': + case 'purchase': + $text_price = 'bills.price'; + break; + default: $text_price = setting('invoice.price_name', 'invoices.price'); if ($text_price == 'custom') { $text_price = setting('invoice.price_name_input'); } break; - case 'bill': - case 'expense': - case 'purchase': - $text_price = 'bills.price'; - break; } return $text_price; @@ -438,16 +420,7 @@ abstract class DocumentTemplate extends Component return $textAmount; } - switch ($type) { - case 'sale': - case 'income': - case 'invoice': - case 'bill': - case 'expense': - case 'purchase': - $textAmount = 'general.amount'; - break; - } + $textAmount = 'general.amount'; return $textAmount; } @@ -470,16 +443,14 @@ abstract class DocumentTemplate extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $hideName = setting('invoice.hide_item_name', $hideName); - break; case 'bill': case 'expense': case 'purchase': $hideName = setting('bill.hide_item_name', $hideName); break; + default: + $hideName = setting('invoice.hide_item_name', $hideName); + break; } return $hideName; @@ -492,16 +463,14 @@ abstract class DocumentTemplate extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $hideDescription = setting('invoice.hide_item_description', $hideDescription); - break; case 'bill': case 'expense': case 'purchase': $hideDescription = setting('bill.hide_item_description', $hideDescription); break; + default: + $hideDescription = setting('invoice.hide_item_description', $hideDescription); + break; } return $hideDescription; @@ -514,16 +483,14 @@ abstract class DocumentTemplate extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $hideQuantity = setting('invoice.hide_quantity', $hideQuantity); - break; case 'bill': case 'expense': case 'purchase': $hideQuantity = setting('bill.hide_quantity', $hideQuantity); break; + default: + $hideQuantity = setting('invoice.hide_quantity', $hideQuantity); + break; } return $hideQuantity; @@ -536,16 +503,14 @@ abstract class DocumentTemplate extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $hidePrice = setting('invoice.hide_price', $hidePrice); - break; case 'bill': case 'expense': case 'purchase': $hidePrice = setting('bill.hide_price', $hidePrice); break; + default: + $hidePrice = setting('invoice.hide_price', $hidePrice); + break; } return $hidePrice; @@ -558,16 +523,14 @@ abstract class DocumentTemplate extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $hideDiscount = setting('invoice.hide_discount', $hideDiscount); - break; case 'bill': case 'expense': case 'purchase': $hideDiscount = setting('bill.hide_discount', $hideDiscount); break; + default: + $hideDiscount = setting('invoice.hide_discount', $hideDiscount); + break; } return $hideDiscount; @@ -580,16 +543,14 @@ abstract class DocumentTemplate extends Component } switch ($type) { - case 'sale': - case 'income': - case 'invoice': - $hideAmount = setting('invoice.hide_amount', $hideAmount); - break; case 'bill': case 'expense': case 'purchase': $hideAmount = setting('bill.hide_amount', $hideAmount); break; + default: + $hideAmount = setting('invoice.hide_amount', $hideAmount); + break; } return $hideAmount; diff --git a/app/View/Components/Documents/Form/Advanced.php b/app/View/Components/Documents/Form/Advanced.php index cb1494cd9..800db9b80 100644 --- a/app/View/Components/Documents/Form/Advanced.php +++ b/app/View/Components/Documents/Form/Advanced.php @@ -30,11 +30,6 @@ class Advanced extends Component $type = ''; switch ($this->type) { - case 'sale': - case 'income': - case 'invoice': - $type = 'income'; - break; case 'bill': case 'expense': case 'purchase': @@ -49,6 +44,9 @@ class Advanced extends Component case 'transfer': $type = 'transfer'; break; + default: + $type = 'income'; + break; } return $type;