diff --git a/app/Http/Controllers/InsuranceController.php b/app/Http/Controllers/InsuranceController.php index 1e08a53..a3fea73 100644 --- a/app/Http/Controllers/InsuranceController.php +++ b/app/Http/Controllers/InsuranceController.php @@ -42,12 +42,22 @@ class InsuranceController extends Controller * name="country_id", * description="ID du pays", * in="query", - * required=true, + * required=false, * @OA\Schema( * type="integer", * default=78 * ) * ), + * @OA\Parameter( + * parameter="user_id", + * name="user_id", + * description="ID de l'utilisateur", + * in="query", + * required=true, + * @OA\Schema( + * type="integer", + * ) + * ), * @OA\Response( * response=200, * description="OK", @@ -66,26 +76,33 @@ class InsuranceController extends Controller public function getInsurancesNetworks(Request $request) { $this->validate($request, [ - 'country_id' => 'nullable|integer|exists:countries,id' + 'country_id' => 'nullable|integer|exists:countries,id', + 'user_id' => 'nullable|integer|exists:users,id' ]); - $country = CountriesCurrency::findOrFail($request->input('country_id')); + $user_id = $request->input('user_id'); + if (!empty($user_id)) { + $insurances = DB::select("SELECT n.id , n.name FROM networks n JOIN configWallet cw ON cw.id_network = n.id JOIN nh_networks_configs nhc + ON nhc.network_id = n.id JOIN nh_insurances nhi ON nhi.network_id = n.id WHERE nhi.user_id = :user_id AND cw.type = 'ilink_sante' AND n.status = 1", ['user_id' => $user_id]); - $insurances = DB::select("SELECT n.id , n.name , nhc.age_limit_of_insured_and_spouse, nhc.age_limit_of_child_beneficiary, nhc.max_number_of_beneficiaries, nhc.id as nhc_id + } else { + $country = CountriesCurrency::findOrFail($request->input('country_id')); + + $insurances = DB::select("SELECT n.id , n.name , nhc.age_limit_of_insured_and_spouse, nhc.age_limit_of_child_beneficiary, nhc.max_number_of_beneficiaries, nhc.id as nhc_id FROM networks n JOIN configWallet cw ON cw.id_network = n.id JOIN nh_networks_configs nhc ON nhc.network_id = n.id WHERE n.country_id = :countryId AND cw.type = 'ilink_sante' AND n.status = 1", ['countryId' => $request->input('country_id')]); - foreach ($insurances as $insurance) { - $months_prices = DB::select("SELECT id, number_of_months , min_amount FROM nh_months_prices_grid WHERE nh_network_config_id = :nhc_id", - ['nhc_id' => $insurance->nhc_id]); + foreach ($insurances as $insurance) { + $months_prices = DB::select("SELECT id, number_of_months , min_amount FROM nh_months_prices_grid WHERE nh_network_config_id = :nhc_id", + ['nhc_id' => $insurance->nhc_id]); - foreach ($months_prices as $mp) { - $mp->min_amount = $this->toMoneyWithCurrencyCode($mp->min_amount, $country->currency_code ?? 'XAF'); + foreach ($months_prices as $mp) { + $mp->min_amount = $this->toMoneyWithCurrencyCode($mp->min_amount, $country->currency_code ?? 'XAF'); + } + $insurance->months_prices = $months_prices; + unset($insurance->nhc_id); } - $insurance->months_prices = $months_prices; - unset($insurance->nhc_id); } - return $this->successResponse($insurances); } diff --git a/resources/views/emails/invoice.blade.php b/resources/views/emails/invoice.blade.php index 2f1193e..9b97d7b 100755 --- a/resources/views/emails/invoice.blade.php +++ b/resources/views/emails/invoice.blade.php @@ -146,13 +146,13 @@
- iLink World Corporation + {{$hyper->network}}

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

-

Le numérique au service de l'inclusion financière

+ {{--

Le numérique au service de l'inclusion financière

--}}

@@ -203,7 +203,7 @@ color:black'>Le numérique au service de l'inclusion financière

{{$hyper->lastname}} + style='font-size:9.0pt;font-family:"Garamond",serif;color:black'>{{$hyper->network}}

@@ -211,7 +211,7 @@ color:black'>Le numérique au service de l'inclusion financière

{{__('messages.insurance_name')}} + style='font-size:9.0pt;font-family:"Garamond",serif;color:black'>{{__('messages.institution_name')}}