Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Core/Lib/AjaxForms/SalesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ protected function execPreviousAction($action)
case 'fast-line':
case 'fast-product':
case 'new-line':
case 'new-text-line':
case 'recalculate':
case 'rm-line':
case 'set-customer':
Expand Down
32 changes: 32 additions & 0 deletions Core/Lib/AjaxForms/SalesFooterHTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
namespace FacturaScripts\Core\Lib\AjaxForms;

use FacturaScripts\Core\Contract\SalesModInterface;
use FacturaScripts\Core\Model\Base\BusinessDocument;
use FacturaScripts\Core\Model\Base\SalesDocument;
use FacturaScripts\Core\Tools;

Expand Down Expand Up @@ -308,4 +309,35 @@ private static function renderNewModalFields(SalesDocument $model): string

return $html;
}

protected static function newLineBtn(BusinessDocument $model, string $jsName): string
{
if (false === $model->editable) {
return '';
}

$transLine = Tools::trans('line');
$transTextLine = Tools::trans('text-line');

return <<<HTML
<div class="dropdown col-3 col-md-auto">
<button class="btn btn-success w-100 mb-2 dropdown-toggle" type="button"
data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-plus fa-fw"></i> {$transLine}
</button>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item btn-spin-action" href="#" onclick="return {$jsName}('new-line', '0');">
<i class="fa-solid fa-plus fa-fw"></i> {$transLine}
</a>
</li>
<li>
<a class="dropdown-item btn-spin-action" href="#" onclick="return {$jsName}('new-text-line', '0');">
<i class="fa-solid fa-plus fa-fw"></i> {$transTextLine}
</a>
</li>
</ul>
</div>
HTML;
}
}
5 changes: 5 additions & 0 deletions Core/Lib/AjaxForms/SalesLineHTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ public static function apply(SalesDocument &$model, array &$lines, array $formDa
}
} elseif ($formData['action'] === 'new-line') {
$lines[] = $model->getNewLine();
} elseif ($formData['action'] === 'new-text-line') {
$text_line = $model->getNewLine();
$text_line->mostrar_cantidad = false;
$text_line->mostrar_precio = false;
$lines[] = $text_line;
}

// mods
Expand Down
1 change: 1 addition & 0 deletions Core/View/Tab/SalesDocument.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
break;

case 'new-line':
case 'new-text-line':
$(".doc-line-desc:last").focus();
break;

Expand Down
Loading