mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-26 14:34:42 +00:00
Create invoice form part 1.
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
* $out = $connector->findByIco('44315945');
|
||||
* echo ''.print_r($out, 1).'';
|
||||
*/
|
||||
|
||||
namespace App\Services\Oasis;
|
||||
|
||||
class CzechRegisterSearchService
|
||||
@@ -85,9 +84,11 @@ class CzechRegisterSearchService
|
||||
if (preg_match('/^\d{8}$/', $ico)) {
|
||||
$url = self::URL_SERVER . '?ico=' . $ico;
|
||||
$response = file_get_contents($url);
|
||||
|
||||
if ($response) {
|
||||
$response = self::extractSubjects($response);
|
||||
if (!empty($response[0])) {
|
||||
|
||||
if (! empty($response[0])) {
|
||||
$response = $response[0];
|
||||
}
|
||||
}
|
||||
@@ -96,7 +97,6 @@ class CzechRegisterSearchService
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return matched formatted for autocomplete dropdown list
|
||||
* @param string $term Searched matching string
|
||||
@@ -116,8 +116,7 @@ class CzechRegisterSearchService
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($subjects) && is_array($subjects)) {
|
||||
|
||||
if (! empty($subjects) && is_array($subjects)) {
|
||||
$subjects = array_slice($subjects, 0, $size); // return first $size matches
|
||||
|
||||
foreach ($subjects as &$subject) {
|
||||
@@ -129,7 +128,7 @@ class CzechRegisterSearchService
|
||||
}
|
||||
|
||||
foreach ($subjects as $subject) {
|
||||
if (!empty($subject['ico'])) {
|
||||
if (! empty($subject['ico'])) {
|
||||
$out[] = [
|
||||
'value' => $subject['ico'],
|
||||
'label' => "{$subject['shortname']} (IČO: {$subject['ico']})",
|
||||
@@ -149,15 +148,15 @@ class CzechRegisterSearchService
|
||||
protected static function extractSubjects($html)
|
||||
{
|
||||
// ensure valid XHTML markup
|
||||
if (!extension_loaded('tidy')) {
|
||||
if (! extension_loaded('tidy')) {
|
||||
throw new \Exception('Missing extension [tidy].');
|
||||
}
|
||||
|
||||
$tidy = new \tidy();
|
||||
$html = $tidy->repairString($html, array(
|
||||
'output-xhtml' => true,
|
||||
$html = $tidy->repairString($html, [
|
||||
'output-xhtml' => true,
|
||||
'show-body-only' => true,
|
||||
), 'utf8');
|
||||
], 'utf8');
|
||||
|
||||
// purify whitespaces - vkladaju \n alebo
|
||||
$html = strtr($html, [
|
||||
@@ -174,26 +173,25 @@ class CzechRegisterSearchService
|
||||
$out = [];
|
||||
|
||||
if ($rows->length) {
|
||||
|
||||
foreach ($rows as $row) {
|
||||
|
||||
// Nazev
|
||||
$nodeList = $xpath->query("./tr[1]/td[1]", $row);
|
||||
if (!$nodeList->length) {
|
||||
$nodeList = $xpath->query('./tr[1]/td[1]', $row);
|
||||
|
||||
if (! $nodeList->length) {
|
||||
continue; // nazev je povinny
|
||||
}
|
||||
$name = $nodeList->item(0)->nodeValue;
|
||||
$name = preg_replace('/\s+/', ' ', $name); // viacnasobne inside spaces
|
||||
|
||||
// ICO
|
||||
$nodeList = $xpath->query("./tr[1]/td[2]", $row);
|
||||
$nodeList = $xpath->query('./tr[1]/td[2]', $row);
|
||||
$ico = $nodeList->length ? $nodeList->item(0)->nodeValue : '';
|
||||
|
||||
// adresa - neda sa spolahnut na poradie prvkov :-(
|
||||
$city = '';
|
||||
$nodeList = $xpath->query("./tr[3]/td[1]", $row);
|
||||
if ($nodeList->length) {
|
||||
$nodeList = $xpath->query('./tr[3]/td[1]', $row);
|
||||
|
||||
if ($nodeList->length) {
|
||||
$addr = trim($nodeList->item(0)->nodeValue);
|
||||
|
||||
if (preg_match('/,\s*(\d{3} ?\d{2})\s+(.+)$/', $addr, $match)) {
|
||||
@@ -206,9 +204,10 @@ class CzechRegisterSearchService
|
||||
list($city, $addr_streetnr) = explode(',', $addr);
|
||||
$addr_city = $city;
|
||||
$addr_zip = $match[1];
|
||||
} elseif (!preg_match('/\d{3} ?\d{2}/', $addr, $match)) {
|
||||
} elseif (! preg_match('/\d{3} ?\d{2}/', $addr, $match)) {
|
||||
// Ústí nad Labem, Masarykova 74 - bez PSC - obec, ulice a cislo
|
||||
$addr_streetnr = $addr_zip = '';
|
||||
|
||||
if (false !== strpos($addr, ',')) {
|
||||
list($city, $addr_streetnr) = explode(',', $addr);
|
||||
} else {
|
||||
@@ -227,15 +226,15 @@ class CzechRegisterSearchService
|
||||
}
|
||||
|
||||
$out[] = [
|
||||
'name' => self::trimQuotes($name),
|
||||
'ico' => preg_replace('/[^\d]/', '', $ico),
|
||||
'city' => self::trimQuotes($city),
|
||||
'name' => self::trimQuotes($name),
|
||||
'ico' => preg_replace('/[^\d]/', '', $ico),
|
||||
'city' => self::trimQuotes($city),
|
||||
// pre polia s adresou konzistentne so smartform naseptavacem
|
||||
'addr_city' => self::trimQuotes($addr_city),
|
||||
'addr_zip' => preg_replace('/[^\d]/', '', $addr_zip),
|
||||
'addr_city' => self::trimQuotes($addr_city),
|
||||
'addr_zip' => preg_replace('/[^\d]/', '', $addr_zip),
|
||||
'addr_streetnr' => self::trimQuotes($addr_streetnr),
|
||||
// len pre kontrolu - plna povodna adresa
|
||||
'addr_full' => self::trimQuotes($addr),
|
||||
'addr_full' => self::trimQuotes($addr),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -251,5 +250,4 @@ class CzechRegisterSearchService
|
||||
{
|
||||
return trim(strtr($s, ['"' => '', "'" => '']));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Services\Oasis;
|
||||
|
||||
|
||||
use App\Models\Oasis\Client;
|
||||
use App\Models\Oasis\Invoice;
|
||||
use App\Models\User;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use App\Models\Oasis\Invoice;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Database\Eloquent\Factories\Sequence;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
|
||||
class OasisDevService
|
||||
{
|
||||
@@ -23,4 +18,4 @@ class OasisDevService
|
||||
->with('invoice', Invoice::first())
|
||||
->with('user', User::whereEmail('howdy@hi5ve.digital')->first());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Services\Oasis;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Services\StripeService;
|
||||
use App\Models\Oasis\SubscriptionRequest;
|
||||
use App\Notifications\Oasis\ReminderForPaymentRequiredNotification;
|
||||
use App\Services\StripeService;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class OasisService
|
||||
{
|
||||
@@ -20,21 +17,20 @@ class OasisService
|
||||
SubscriptionRequest::whereStatus('requested')
|
||||
->get()
|
||||
->each(function ($request) {
|
||||
|
||||
// Get diffInHours
|
||||
$diff = Carbon::parse($request->created_at)
|
||||
->diffInHours(Carbon::now());
|
||||
|
||||
// Send order reminder
|
||||
if ($diff == 8) {
|
||||
|
||||
$plan = resolve(StripeService::class)
|
||||
->getPlan($request->requested_plan);
|
||||
|
||||
$request->user->notify(new ReminderForPaymentRequiredNotification(
|
||||
$request, $plan
|
||||
$request,
|
||||
$plan
|
||||
));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
class StripeService
|
||||
{
|
||||
|
||||
/**
|
||||
* Stripe Service constructor.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user