<?php
namespace Bdp\Modules\EventParticipants\Controllers;

use Bdp\Modules\EventParticipants\Models\EventParticipant;

class UpdateMemberAmountController {
	public function __construct() {
		global $_POST, $_REQUEST, $dbHandler;

		$amount = str_replace(',', '.', $_POST['beitrag_bezahlt']);
		$dbHandler->updateRows(
			'kompass_veranstaltungen_teilis',
			['beitrag_bezahlt' => $amount],
			['id' => $_POST['participant-id']]
		);
		kompass_print_message_box(__('Participation data updated successfull.', BDP_LV_PLUGIN_SLUG));
		$participant = EventParticipant::loadById($_REQUEST['participant-id']);
		new ListGroupsAndMembersController($participant->eventId);
	}
}