<?php
namespace Modules\Orders\Details\PassengersServicesAssociations; class View_Index extends \App\Mvc\View_Popup_PaginatedListing_IndexAbstract { protected $renderingTemplate=null; protected function render_smarty($templateName=null) { $hiddenInputs = []; $definedPaxInputs = []; $p=0; foreach ($this->input['passengersList'] as $index=>$passenger) { $s=0; foreach ($this->input['servicesList'] as $idService=>$servDet) { $checkFld = \Engine\Form\Input\Checkbox::create(null, "servicesPassengers[".$idService."][".$passenger['id']."]", in_array($passenger['id'], $this->input['servicesPassengersAssociations'][$idService]) ? 1 : 0); $checkFld->setId("servicesPassengers[{$s}][{$p}]"); $checkFld->setTooltip("passenger: {$passenger['firstName']} {$passenger['lastName']}<br>service: {$servDet['service']} [{$servDet['statusOp']}/{$servDet['statusFin']}], ".\Engine\DateTime::create($servDet['startDate'])->formatDateStd()); if ($servDet['idImportedService'] or $servDet['blockPassengerCheckbox'][$passenger['id']] or $servDet['balanced']) { $checkFld->setDisabled(); $hiddFld = \Engine\Form\Input\Hidden::create(null, "servicesPassengers[".$idService."][".$passenger['id']."]", in_array($passenger['id'], $this->input['servicesPassengersAssociations'][$idService]) ? 1 : 0); $hiddenInputs[] = $hiddFld; } $definedPaxInputs[$passenger['id']][$idService] = $checkFld; $s++; } $p++; } $undefinedPaxInputs = []; foreach ($this->input['orderUndefinedPax'] as $undefinedPaxType => $undefinedPaxCount) { foreach ($this->input['servicesList'] as $idService=>$servDet) { $undefFld = \Engine\Form\Input\Text::create(null, "undefinedPax[".$idService."][".$undefinedPaxType."]", $servDet['undefinedPax'][$undefinedPaxType]); $undefFld->setStyle('width', '30'); $undefFld->setCustomHTML('/ '.$undefinedPaxCount); if ($servDet['idImportedService'] or $servDet['balanced']) { $undefFld->setDisabled(); $hiddFld = \Engine\Form\Input\Hidden::create(null, "undefinedPax[".$idService."][".$undefinedPaxType."]", $servDet['undefinedPax'][$undefinedPaxType]); $hiddenInputs[] = $hiddFld; } $undefinedPaxInputs[$undefinedPaxType][$idService] = $undefFld; } } $this->setOutputVar('definedPaxInputsChunked', array_chunk($definedPaxInputs, 20, true)); $this->setOutputVar('undefinedPaxInputs', $undefinedPaxInputs); $this->setOutputVar('hiddenInputs', $hiddenInputs); $this->setOutputVar('passengersList', $this->input['passengersList']); $this->setOutputVar('servicesList', $this->input['servicesList']); return parent::render_smarty($templateName); } } 