diff --git a/.gitignore b/.gitignore index df42b85..5cf2731 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,6 @@ Homestead.yaml /resources/views/vendor /storage/api-docs /public/swagger-ui-assets -public/insurances-subscriptions-docs +/public/insurances-subscriptions-docs +/public/qrcodes composer.lock diff --git a/app/Helpers/paths.php b/app/Helpers/paths.php new file mode 100644 index 0000000..4292c64 --- /dev/null +++ b/app/Helpers/paths.php @@ -0,0 +1,267 @@ +asset($path, $secured); + } +} + +if (!function_exists('config_path')) { + /** + * Return the path to config files + * @param null $path + * @return string + */ + function config_path($path = null) + { + return app()->getConfigurationPath(rtrim($path, ".php")); + } +} + +if (!function_exists('public_path')) { + + /** + * Return the path to public dir + * @param null $path + * @return string + */ + function public_path($path = null) + { + return rtrim(app()->basePath('public/' . $path), '/'); + } +} + +if (!function_exists('storage_path')) { + + /** + * Return the path to storage dir + * @param null $path + * @return string + */ + function storage_path($path = null) + { + return app()->storagePath($path); + } +} + +if (!function_exists('database_path')) { + + /** + * Return the path to database dir + * @param null $path + * @return string + */ + function database_path($path = null) + { + return app()->databasePath($path); + } +} + +if (!function_exists('resource_path')) { + + /** + * Return the path to resource dir + * @param null $path + * @return string + */ + function resource_path($path = null) + { + return app()->resourcePath($path); + } +} + +//if (!function_exists('lang_path')) { +// +// /** +// * Return the path to lang dir +// * @param null $str +// * @return string +// */ +// function lang_path($path = null) +// { +// return app()->getLanguagePath($path); +// } +//} + +if (!function_exists('asset')) { + /** + * Generate an asset path for the application. + * + * @param string $path + * @param bool $secure + * @return string + */ + function asset($path, $secure = null) + { + return app('url')->asset($path, $secure); + } +} + +if (!function_exists('elixir')) { + /** + * Get the path to a versioned Elixir file. + * + * @param string $file + * @return string + */ + function elixir($file) + { + static $manifest = null; + if (is_null($manifest)) { + $manifest = json_decode(file_get_contents(public_path() . '/build/rev-manifest.json'), true); + } + if (isset($manifest[$file])) { + return '/build/' . $manifest[$file]; + } + throw new InvalidArgumentException("File {$file} not defined in asset manifest."); + } +} + +if (!function_exists('auth')) { + /** + * Get the available auth instance. + * + * @return \Illuminate\Contracts\Auth\Guard + */ + function auth() + { + return app('Illuminate\Contracts\Auth\Guard'); + } +} + +if (!function_exists('bcrypt')) { + /** + * Hash the given value. + * + * @param string $value + * @param array $options + * @return string + */ + function bcrypt($value, $options = array()) + { + return app('hash')->make($value, $options); + } +} + +if (!function_exists('redirect')) { + /** + * Get an instance of the redirector. + * + * @param string|null $to + * @param int $status + * @param array $headers + * @param bool $secure + * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse + */ + function redirect($to = null, $status = 302, $headers = array(), $secure = null) + { + if (is_null($to)) return app('redirect'); + return app('redirect')->to($to, $status, $headers, $secure); + } +} + +if (!function_exists('response')) { + /** + * Return a new response from the application. + * + * @param string $content + * @param int $status + * @param array $headers + * @return \Symfony\Component\HttpFoundation\Response|\Illuminate\Contracts\Routing\ResponseFactory + */ + function response($content = '', $status = 200, array $headers = array()) + { + $factory = app('Illuminate\Contracts\Routing\ResponseFactory'); + if (func_num_args() === 0) { + return $factory; + } + return $factory->make($content, $status, $headers); + } +} + +if (!function_exists('secure_asset')) { + /** + * Generate an asset path for the application. + * + * @param string $path + * @return string + */ + function secure_asset($path) + { + return asset($path, true); + } +} + +if (!function_exists('secure_url')) { + /** + * Generate a HTTPS url for the application. + * + * @param string $path + * @param mixed $parameters + * @return string + */ + function secure_url($path, $parameters = array()) + { + return url($path, $parameters, true); + } +} + + +if (!function_exists('session')) { + /** + * Get / set the specified session value. + * + * If an array is passed as the key, we will assume you want to set an array of values. + * + * @param array|string $key + * @param mixed $default + * @return mixed + */ + function session($key = null, $default = null) + { + if (is_null($key)) return app('session'); + if (is_array($key)) return app('session')->put($key); + return app('session')->get($key, $default); + } +} + + +if (!function_exists('cookie')) { + /** + * Create a new cookie instance. + * + * @param string $name + * @param string $value + * @param int $minutes + * @param string $path + * @param string $domain + * @param bool $secure + * @param bool $httpOnly + * @return \Symfony\Component\HttpFoundation\Cookie + */ + function cookie($name = null, $value = null, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true) + { + $cookie = app('Illuminate\Contracts\Cookie\Factory'); + if (is_null($name)) { + return $cookie; + } + return $cookie->make($name, $value, $minutes, $path, $domain, $secure, $httpOnly); + } +} diff --git a/app/Http/Controllers/InsuredController.php b/app/Http/Controllers/InsuredController.php new file mode 100755 index 0000000..d22f4bb --- /dev/null +++ b/app/Http/Controllers/InsuredController.php @@ -0,0 +1,81 @@ +input('name'); + $phone = $request->input('phone'); + + $insured = NhInsurance::with(['user', 'network:id,name'])->whereHas('user', function ($query) use ($name, $phone) { + $query->where('lastname', 'like', '%' . $name . '%')->orWhere('phone', 'like', '%' . $phone . '%'); + })->limit(20)->get(); + + return $this->successResponse($insured); + } +} diff --git a/app/Http/Controllers/QRCodeController.php b/app/Http/Controllers/QRCodeController.php new file mode 100755 index 0000000..442c8a7 --- /dev/null +++ b/app/Http/Controllers/QRCodeController.php @@ -0,0 +1,74 @@ + $user->lastname, 'data' => $user->id]) + ->setPaper('a4', 'portrait')->setWarnings(false)->save(public_path($directoryName . $user->id . '.pdf')); +// $recipients = [preg_replace("/\s+/", "", $email)]; // Supprimer les espaces dans le mail +// Mail::mailer('smtp')->raw($messageText, function ($message) use ($recipients, $title, $pdf, $notice) { +// $message->subject($title) +// ->to($recipients) +// ->attachData($pdf->output(), $title . ' - ' . $notice->id_tax_notice . ".pdf"); +// }); + + $user->has_qr_code = 1; + $user->save(); + return $this->successResponse(trans('messages.successful_transaction')); + } catch (\Throwable $t) { + Log::error('-------- Mail not sent -----------'); + Log::error($t->getMessage()); + return $this->errorResponse(trans('errors.unexpected_error')); + } + } + + //Generer le QRCode d'un utilisateur à partir de son id + public function read($id_user) + { + $user = User::findOrFail($id_user); + return $this->successResponse($user); + } + + //Generer l'image du QRCode d'un utilisateur à partir de son id + public function image($id_user) + { + $user = User::findOrFail($id_user); + return $this->successResponse(base64_encode(\SimpleSoftwareIO\QrCode\Facades\QrCode::format('svg') + ->size(300)->errorCorrection('H') + ->generate($user->id))); + } +} diff --git a/bootstrap/app.php b/bootstrap/app.php index 862ff6f..8dee8e8 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -63,6 +63,7 @@ $app->configure('app'); $app->configure('swagger-lume'); $app->configure('services'); $app->configure('sentry'); +$app->configure('dompdf'); /* |-------------------------------------------------------------------------- @@ -103,6 +104,7 @@ $app->register(\SwaggerLume\ServiceProvider::class); $app->register(\MigrationsGenerator\MigrationsGeneratorServiceProvider::class); $app->register('Sentry\Laravel\ServiceProvider'); $app->register('Sentry\Laravel\Tracing\ServiceProvider'); +$app->register(\Barryvdh\DomPDF\ServiceProvider::class); /* |-------------------------------------------------------------------------- diff --git a/composer.json b/composer.json index 70b3945..be28a44 100644 --- a/composer.json +++ b/composer.json @@ -8,12 +8,14 @@ "php": "^7.3|^8.0", "ext-gd": "*", "ext-json": "*", + "barryvdh/laravel-dompdf": "^0.9.0", "brick/money": "^0.5.2", "darkaonline/swagger-lume": "^8.0", "guzzlehttp/guzzle": "^7.3", "kitloong/laravel-migrations-generator": "^5.0", "laravel/lumen-framework": "^8.0", - "sentry/sentry-laravel": "^2.9" + "sentry/sentry-laravel": "^2.9", + "simplesoftwareio/simple-qrcode": "^4.2" }, "require-dev": { "fakerphp/faker": "^1.9.1", @@ -27,7 +29,8 @@ "Database\\Seeders\\": "database/seeders/" }, "files": [ - "app/Helpers/common.php" + "app/Helpers/common.php", + "app/Helpers/paths.php" ] }, "autoload-dev": { diff --git a/resources/lang/en/messages.php b/resources/lang/en/messages.php index 7d25ced..7f5aa8c 100755 --- a/resources/lang/en/messages.php +++ b/resources/lang/en/messages.php @@ -52,9 +52,9 @@ Your application has been rejected. Reason for rejection: :reason ", 'insurance_subscription_rejected_notification' => "Your :subscription_id application has been rejected", - "insurance_subscription_successful" => "Insurance subscription successful", - 'insurance_subscription_updated' => "Insurance subscription update", - "insurance_subscription_updated_successful" => "Insurance subscription update successful", + "insurance_subscription_successful" => "Insurance subscription application submitted", + 'insurance_subscription_updated' => "Insurance subscription application update", + "insurance_subscription_updated_successful" => "Insurance subscription application updated successful", 'insurance_subscription_paid' => "Insurance subscription paid", 'insurance_subscription_paid_mail' => ":gender :name , @@ -67,7 +67,7 @@ Your insurance has been validated. - Number of beneficiaries : :number_of_beneficiaries - Number of months: :months ", - 'insurance_subscription_awaiting_more_information' => "Insurance subscription waiting for more information", + 'insurance_subscription_awaiting_more_information' => "Insurance subscription application waiting for more information", 'insurance_subscription_awaiting_more_information_mail' => ":gender :name , Your application is waiting for more information. @@ -79,8 +79,8 @@ Your application is waiting for more information. Message: :reason", 'insurance_subscription_awaiting_more_information_notification' => "Your :subscription_id application is waiting for more information", - 'insurance_addition_beneficiary_successful' => "Adding a beneficiary to your insurance successful", - 'insurance_addition_beneficiary' => "Adding a beneficiary to your insurance", + 'insurance_addition_beneficiary_successful' => "Request of adding a beneficiary to your insurance successful", + 'insurance_addition_beneficiary' => "Request of adding a beneficiary to your insurance", 'insurance_addition_beneficiary_mail' => ":gender :name , Your request to add a beneficiary to your insurance is being validated. diff --git a/resources/lang/fr/messages.php b/resources/lang/fr/messages.php index e643875..449db4c 100755 --- a/resources/lang/fr/messages.php +++ b/resources/lang/fr/messages.php @@ -16,7 +16,7 @@ return [ 'user_not_identificated' => 'Utilisateur non identifié', 'identification_already_validated' => 'Identification deja validée', 'successful_card_attachment' => 'Rattachement de votre carte effectuée', - 'insurance_subscription' => "Souscription à l'assurance", + 'insurance_subscription' => "Demande de souscription à l'assurance", 'insurance_subscription_mail' => ":gender :name , Votre demande de souscription est en cours de validation. @@ -26,7 +26,7 @@ Votre demande de souscription est en cours de validation. - Montant de la prime : :bonus_amount - Nombre d'ayants droit : :number_of_beneficiaries ", - 'insurance_subscription_accepted' => "Souscription à l'assurance acceptée", + 'insurance_subscription_accepted' => "Demande de souscription à l'assurance acceptée", 'insurance_subscription_accepted_mail' => ":gender :name , Votre demande de souscription a été acceptée. @@ -40,7 +40,7 @@ Votre demande de souscription a été acceptée. ", 'insurance_subscription_accepted_notification' => "Votre demande de souscription :subscription_id a été acceptée. Assurer-vous que votre wallet a le crédit suffisant pour activer votre assurance", - 'insurance_subscription_rejected' => "Souscription à l'assurance rejetée", + 'insurance_subscription_rejected' => "Demande de souscription à l'assurance rejetée", 'insurance_subscription_rejected_mail' => ":gender :name , Votre demande de souscription a été rejetée. @@ -67,7 +67,7 @@ Votre assurance a été validée. - Nombre d'ayants droit : :number_of_beneficiaries - Nombre de mois : :months ", - 'insurance_subscription_awaiting_more_information' => "Souscription à l'assurance en attente de plus d'informations", + 'insurance_subscription_awaiting_more_information' => "Demande de souscription à l'assurance en attente de plus d'informations", 'insurance_subscription_awaiting_more_information_mail' => ":gender :name , Votre demande de souscription est en attente de plus d'informations. @@ -80,7 +80,7 @@ Votre demande de souscription est en attente de plus d'informations. Message : :reason", 'insurance_subscription_awaiting_more_information_notification' => "Votre demande de souscription :subscription_id est en attente de plus d'informations.", 'insurance_addition_beneficiary_successful' => "Demande d'ajout d'ayant droit à votre assurance réussie", - 'insurance_addition_beneficiary' => "Ajout d'ayant droit à votre assurance", + 'insurance_addition_beneficiary' => "Demande d'ajout d'ayant droit à votre assurance", 'insurance_addition_beneficiary_mail' => ":gender :name , Votre demande d'ajout d'ayant droit à votre assurance est en cours de validation. diff --git a/resources/views/emails/qr_code.blade.php b/resources/views/emails/qr_code.blade.php new file mode 100755 index 0000000..59a88fa --- /dev/null +++ b/resources/views/emails/qr_code.blade.php @@ -0,0 +1,200 @@ + + + + + + + + + + + + + +
+ +

+ REPUBLIQUE GABONAISE + + ------------------- + + Union-Travail-Justice + + PROVINCE +DE L’ESTUAIRE

+ +

-------------------

+ +

DEPARTEMENT DU KOMO-MONDAH

+ +

-----------------

+ +

COMMUNE D’AKANDA

+ +

---------------

+ +

SECRETARIAT GENERAL

+ +

-----------------

+ +

SERVICE FISCALITE ET RECOUVREMENT

+ +

QR CODE - {{$lastname}} +

+ +
+ +
+
+ + + diff --git a/resources/views/emails/tax_notice.blade.php b/resources/views/emails/tax_notice.blade.php new file mode 100755 index 0000000..80e00fe --- /dev/null +++ b/resources/views/emails/tax_notice.blade.php @@ -0,0 +1,795 @@ + + + + + + + + + + + + + +
+ +

+ REPUBLIQUE GABONAISE + + ------------------- + + Union-Travail-Justice + + PROVINCE +DE L’ESTUAIRE

+ +

-------------------

+ +

DEPARTEMENT DU KOMO-MONDAH

+ +

-----------------

+ +

COMMUNE D’AKANDA

+ +

---------------

+ +

SECRETARIAT GENERAL

+ +

-----------------

+ +

SERVICE FISCALITE ET RECOUVREMENT

+ +

AVIS +DE RECOUVREMENT N° {{$id_tax_notice}}

+ +

+ En application de la loi des finances rectificative 2009, Titre III relatives aux ressources des collectivités + locales en son article 15 + et de la Délibération n°006/PE/DKM/CA/CM/SG du 26 juin 2014 portant prélèvement des droits et taxes sur + le territoire de la Commune d’Akanda. +

+ + +

Il est établi un avis de recouvrement relatif à vos activités ci-après défini : +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Opérateur + économique d’Akanda

+
+

Administration + Municipale

+
+

Nom/Identifiant + OPEC

+
+

{{$lastname}}

+
+

Arrondissement

+
+

{{$district}} +

+
+

Non du + Responsable

+
+

{{$responsable_name}}

+
+

Quartier

+
+

{{$neighborhood}} +

+
+

N° RCCM +

+
+

{{$trade_registry}}

+
+

Activité

+
+

{{$activity_type}} +

+
+

NIF +

+
+

{{$identification_number}}

+
+

Année N-1 {{$registration_year-1}}

+
+

{{ $year_tax_paid_N_1 ? 'Payé' : 'Non Payé' }} +

+
+

Patente +

+
+

{{ isset($id_patente) ? 'N° '.$id_patente : 'Non' }}

+
+

Année N-2 {{$registration_year-2}}

+
+

{{ $year_tax_paid_N_2 ? 'Payé' : 'Non Payé' }} +

+
+

Agrément +

+
+

{{ isset($technical_approval) ? 'N° '.$technical_approval : 'Non' }}

+
+

Année N-3 {{$registration_year-3}}

+
+

{{ $year_tax_paid_N_3 ? 'Payé' : 'Non Payé' }} +

+
+

TVA +

+
+

{{ $TVA ? 'Oui' : 'Non' }}

+
+

 

+
+

  +

+
+

IRPP +

+
+

{{ $IRPP ? 'Oui' : 'Non' }}

+
+

 

+
+

  +

+
+

Localisation +

+
+

N_____E_____O_____S_____

+
+

+
+

+

+
+

{{ $adresse }}

+
+

Pénalité d’office

+
+

{{$office_penalties}} +

+
+

Contact(s) +

+
+

{{$phone}}

+
+

Pénalités par mois de retard

+
+

{{$month_delay_penalties}} +

+
+ +

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +

+ + + + + + + + + + + + + @foreach($taxes as $tax) + format($tax->amount); + $unit = $tax->measurement_unit; + if ($tax->measurement_unit == 'forfait') { + $quantity = $tax->count; + if ($tax->billing_period == 'jour') { + $quantity = $jours * $quantity; + $unit = 'jour'; + } + if ($tax->billing_period == 'trimestre') { + $quantity = 4 * $quantity; + $unit = 'trimestre'; + } + if ($tax->billing_period == 'semestre') { + $quantity = 2 * $quantity; + $unit = 'semestre'; + } + } elseif (strpos($tax->measurement_unit, '/')) { + $quantity = $fmt->format($tax->tax_units_count) . ' / ' . $fmt->format($tax->units_per_tax_unit_count); + } else { + $quantity = $fmt->format($tax->tax_units_count); + } + + if ($tax->measurement_unit == '%') { + $unit_price = $fmt->format($tax->unit_price) . ' %'; + } else { + $unit_price = $fmt->format($tax->unit_price); + } + ?> + + + + + + + + + @endforeach +
+

Imputation +

+
+

Libellé + taxe(s) ou redevance(s)

+
+

Unité +

+
+

Qté +

+
+

Prix + Unitaire

+
+

Total +

+
+

{{$tax->imputation}}

+
+

{{$tax->name}}

+
+

{{$unit}} +

+
+

{{$quantity}} +

+
+

{{$unit_price}} +

+
+

{{$tax_amount}} +

+
+ +

 

+ @if(isset($penalties) and sizeof($penalties) > 0) + + + + + + + + + + + + @foreach($penalties as $penalty) + + + + + + + + + + + @endforeach +
+

Imputation +

+
+

Libellé pénalité(s) +

+
+

Unité +

+
+

Qté +

+
+

Prix + Unitaire

+
+

Taux

+
+

Total +

+
+

{{$penalty->imputation}}

+
+

{{$penalty->name}}

+
+

{{$penalty->n_order == 2 ? $penalty->unit : ''}} +

+
+

{{$penalty->n_order == 2 ? $penalty->quantity : ''}} +

+
+

{{$penalty->n_order == 2 ? $fmt->format($penalty->unit_price_no_formatted) : ''}} +

+
+

{{$penalty->n_order == 1 ?$penalty->rate.'%' : ''}} +

+
+

{{$penalty->n_order == 1 ? $fmt->format($penalty->amount) : $fmt->format($penalty->tax_amount)}} +

+
+ +

  + @endif + + + + + +
+

TOTAL A PAYER

+
+

{{$amount}} +

+
+ +

 

+ +

 

+ +

Arrêté le présent avis à la +somme de {{$amount}}

+ +

Date limite de paiement : {{$payment_deadline_date}}

+ +

 

+ +

Les règlements s’effectuent à la Perception Municipale d’Okala +sur présentation d’un(es) ordre(s) de recette(s) préalablement établi(s) au +Service Finances et Comptabilité à l’Hôtel de Ville de la Mairie d’Akanda (heures +d’ouverture de 09H-15H). En cas de règlement par chèque (CERTIFIE), le +libeller au nom du Receveur municipale. 

+ +

 

+ +

Toute infraction aux +dispositions de la présente délibération entraine l’application des sanctions +prévues au code des impôts relatives à l’application des pénalités :

+ +

 

+ +

-        +Pénalité d’office de {{$officePenaltyPercent ?? 10}} % des droits éludés passé le délai de +paiement ;

+ +

-        +{{$monthDelayPenaltyPercent ?? 3}} % par mois de retard ;

+ +

-        +Enfin, en cas de contestation ou de réclamation, vous munir des +pièces justificatives.

+ +

 

+ +

 

+ +
+ +

_____________________________________________________________________________________________________________________ +

+

Service Comptabilité, Fiscalité et recouvrement I Mairie d’Akanda-Hôtel de Ville

+

Contacts : +241 00 000 000 0 / +241 002 6660 50

+

 

+ + + + diff --git a/routes/web.php b/routes/web.php index c63d237..f043f13 100644 --- a/routes/web.php +++ b/routes/web.php @@ -30,4 +30,16 @@ $router->group(['prefix' => '', 'middleware' => 'auth'], function () use ($route $router->get('', 'InsuranceSubscriptionController@getSubscriptions'); }); }); + + // Insurances routes + $router->group(['prefix' => '/insured'], function () use ($router) { + //Search + $router->get('search', 'InsuredController@searchInsured'); + }); + + + //QRCode for agents + $router->get('qrcode/generate/{id_user}', 'QRCodeController@generate'); + $router->get('qrcode/read/{id_user}', 'QRCodeController@read'); + $router->get('qrcode/image/{id_user}', 'QRCodeController@image'); });