feat(sales): fresh sales implementation

This commit is contained in:
Darko Gjorgjijoski
2026-08-21 01:26:48 +02:00
parent e5dc314b68
commit 5269344458
53 changed files with 5736 additions and 0 deletions
@@ -0,0 +1,36 @@
<?php
namespace App\Domains\Sales\Http\Controllers\Company;
use App\Domains\Sales\Models\RecurringInvoice;
use App\Platform\Http\Controller;
use Illuminate\Http\Request;
/**
* Previews the moment a schedule would fire for the first time.
*/
class RecurringInvoiceFrequencyController extends Controller
{
/**
* Read a cron expression and a start date, and answer with the first
* firing they produce.
*
* The schedule form asks for this while it is still being filled in, so
* nothing here is gated or written down — the date is worked out, handed
* back and forgotten. A start date the parser cannot read, or an
* expression it cannot parse, comes back as a server error rather than a
* validation message.
*/
public function __invoke(Request $request)
{
$nextRun = RecurringInvoice::getNextInvoiceDate(
$request->input('frequency'),
$request->input('starts_at'),
);
return response()->json([
'success' => true,
'next_invoice_at' => $nextRun,
]);
}
}