mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Optimize invoice page
This commit is contained in:
parent
8f90e4ba43
commit
f5a9a66584
@ -269,61 +269,65 @@ class InvoiceController extends BaseController
|
|||||||
private static function getViewModel($invoice)
|
private static function getViewModel($invoice)
|
||||||
{
|
{
|
||||||
$recurringHelp = '';
|
$recurringHelp = '';
|
||||||
foreach (preg_split("/((\r?\n)|(\r\n?))/", trans('texts.recurring_help')) as $line) {
|
|
||||||
$parts = explode('=>', $line);
|
|
||||||
if (count($parts) > 1) {
|
|
||||||
$line = $parts[0].' => '.Utils::processVariables($parts[0]);
|
|
||||||
$recurringHelp .= '<li>'.strip_tags($line).'</li>';
|
|
||||||
} else {
|
|
||||||
$recurringHelp .= $line;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$recurringDueDateHelp = '';
|
$recurringDueDateHelp = '';
|
||||||
foreach (preg_split("/((\r?\n)|(\r\n?))/", trans('texts.recurring_due_date_help')) as $line) {
|
$recurringDueDates = [];
|
||||||
$parts = explode('=>', $line);
|
|
||||||
if (count($parts) > 1) {
|
if ($invoice->is_recurring) {
|
||||||
$line = $parts[0].' => '.Utils::processVariables($parts[0]);
|
foreach (preg_split("/((\r?\n)|(\r\n?))/", trans('texts.recurring_help')) as $line) {
|
||||||
$recurringDueDateHelp .= '<li>'.strip_tags($line).'</li>';
|
$parts = explode('=>', $line);
|
||||||
} else {
|
if (count($parts) > 1) {
|
||||||
$recurringDueDateHelp .= $line;
|
$line = $parts[0].' => '.Utils::processVariables($parts[0]);
|
||||||
|
$recurringHelp .= '<li>'.strip_tags($line).'</li>';
|
||||||
|
} else {
|
||||||
|
$recurringHelp .= $line;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Create due date options
|
foreach (preg_split("/((\r?\n)|(\r\n?))/", trans('texts.recurring_due_date_help')) as $line) {
|
||||||
$recurringDueDates = [
|
$parts = explode('=>', $line);
|
||||||
trans('texts.use_client_terms') => ['value' => '', 'class' => 'monthly weekly'],
|
if (count($parts) > 1) {
|
||||||
];
|
$line = $parts[0].' => '.Utils::processVariables($parts[0]);
|
||||||
|
$recurringDueDateHelp .= '<li>'.strip_tags($line).'</li>';
|
||||||
|
} else {
|
||||||
|
$recurringDueDateHelp .= $line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$ends = ['th','st','nd','rd','th','th','th','th','th','th'];
|
// Create due date options
|
||||||
for($i = 1; $i < 31; $i++){
|
$recurringDueDates = [
|
||||||
if ($i >= 11 && $i <= 13) $ordinal = $i. 'th';
|
trans('texts.use_client_terms') => ['value' => '', 'class' => 'monthly weekly'],
|
||||||
else $ordinal = $i . $ends[$i % 10];
|
];
|
||||||
|
|
||||||
$dayStr = str_pad($i, 2, '0', STR_PAD_LEFT);
|
$ends = ['th','st','nd','rd','th','th','th','th','th','th'];
|
||||||
$str = trans('texts.day_of_month', ['ordinal'=>$ordinal]);
|
for($i = 1; $i < 31; $i++){
|
||||||
|
if ($i >= 11 && $i <= 13) $ordinal = $i. 'th';
|
||||||
|
else $ordinal = $i . $ends[$i % 10];
|
||||||
|
|
||||||
$recurringDueDates[$str] = ['value' => "1998-01-$dayStr", 'data-num' => $i, 'class' => 'monthly'];
|
$dayStr = str_pad($i, 2, '0', STR_PAD_LEFT);
|
||||||
}
|
$str = trans('texts.day_of_month', ['ordinal'=>$ordinal]);
|
||||||
$recurringDueDates[trans('texts.last_day_of_month')] = ['value' => '1998-01-31', 'data-num' => 31, 'class' => 'monthly'];
|
|
||||||
|
$recurringDueDates[$str] = ['value' => "1998-01-$dayStr", 'data-num' => $i, 'class' => 'monthly'];
|
||||||
|
}
|
||||||
|
$recurringDueDates[trans('texts.last_day_of_month')] = ['value' => '1998-01-31', 'data-num' => 31, 'class' => 'monthly'];
|
||||||
|
|
||||||
|
|
||||||
$daysOfWeek = [
|
$daysOfWeek = [
|
||||||
trans('texts.sunday'),
|
trans('texts.sunday'),
|
||||||
trans('texts.monday'),
|
trans('texts.monday'),
|
||||||
trans('texts.tuesday'),
|
trans('texts.tuesday'),
|
||||||
trans('texts.wednesday'),
|
trans('texts.wednesday'),
|
||||||
trans('texts.thursday'),
|
trans('texts.thursday'),
|
||||||
trans('texts.friday'),
|
trans('texts.friday'),
|
||||||
trans('texts.saturday'),
|
trans('texts.saturday'),
|
||||||
];
|
];
|
||||||
foreach(['1st','2nd','3rd','4th'] as $i=>$ordinal){
|
foreach(['1st','2nd','3rd','4th'] as $i=>$ordinal){
|
||||||
foreach($daysOfWeek as $j=>$dayOfWeek){
|
foreach($daysOfWeek as $j=>$dayOfWeek){
|
||||||
$str = trans('texts.day_of_week_after', ['ordinal' => $ordinal, 'day' => $dayOfWeek]);
|
$str = trans('texts.day_of_week_after', ['ordinal' => $ordinal, 'day' => $dayOfWeek]);
|
||||||
|
|
||||||
$day = $i * 7 + $j + 1;
|
$day = $i * 7 + $j + 1;
|
||||||
$dayStr = str_pad($day, 2, '0', STR_PAD_LEFT);
|
$dayStr = str_pad($day, 2, '0', STR_PAD_LEFT);
|
||||||
$recurringDueDates[$str] = ['value' => "1998-02-$dayStr", 'data-num' => $day, 'class' => 'weekly'];
|
$recurringDueDates[$str] = ['value' => "1998-02-$dayStr", 'data-num' => $day, 'class' => 'weekly'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user