Skip to content

Commit

Permalink
[TASK] Update edit template to choose from location records
Browse files Browse the repository at this point in the history
  • Loading branch information
codemonkey1988 committed Nov 6, 2023
1 parent dd94fb8 commit 3386f60
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
8 changes: 7 additions & 1 deletion Classes/Controller/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Fgtclb\AcademicPersons\Types\PhysicalAddressTypes;
use Fgtclb\AcademicPersonsEdit\Domain\Model\Profile;
use Fgtclb\AcademicPersonsEdit\Domain\Repository\AddressRepository;
use Fgtclb\AcademicPersonsEdit\Domain\Repository\LocationRepository;
use Fgtclb\AcademicPersonsEdit\Domain\Repository\ProfileRepository;
use Fgtclb\AcademicPersonsEdit\Event\AfterProfileUpdateEvent;
use Fgtclb\AcademicPersonsEdit\Exception\AccessDeniedException;
Expand Down Expand Up @@ -56,18 +57,22 @@ final class ProfileController extends ActionController

private ProfileTranslator $profileTranslator;

private LocationRepository $locationRepository;

public function __construct(
Context $context,
ProfileRepository $profileRepository,
PersistenceManagerInterface $persistenceManager,
AddressRepository $addressRepository,
ProfileTranslator $profileTranslator
ProfileTranslator $profileTranslator,
LocationRepository $locationRepository
) {
$this->context = $context;
$this->profileRepository = $profileRepository;
$this->persistenceManager = $persistenceManager;
$this->addressRepository = $addressRepository;
$this->profileTranslator = $profileTranslator;
$this->locationRepository = $locationRepository;
}

public function initializeAction(): void
Expand Down Expand Up @@ -164,6 +169,7 @@ public function showProfileEditingFormAction(Profile $profile = null): ResponseI
'maxFileUploadsInBytes' => GeneralUtility::getBytesFromSizeMeasurement(
$this->settings['editForm']['profileImage']['validation']['maxFileSize'] ?? ''
),
'availableLocations' => $this->locationRepository->findAll(),
]);

return $this->htmlResponse();
Expand Down
16 changes: 13 additions & 3 deletions Resources/Private/Partials/ProfileEdit/ProfileContract.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,31 @@ <h3>Contract Information</h3>
</div>

<div class="row mb-3">
<div class="col-6">
<div class="col-12">
<label for="contract-{contract.uid}-position" class="form-label">Position</label>
<f:form.textfield
property="contracts.{contractIterator.index}.position"
id="contract-{contract.uid}-position"
class="form-select"
class="form-control"
maxlength="100"
/>
</div>
<div class="col-6">
<label for="contract-{contract.uid}-location" class="form-label">Location</label>
<f:form.select property="contracts.{contractIterator.index}.location"
id="contract-{contract.uid}-location"
class="form-select"
prependOptionLabel="Please choose"
options="{availableLocations}"
optionLabelField="title"
/>
</div>
<div class="col-6">
<label for="contract-{contract.uid}-room" class="form-label">Room</label>
<f:form.textfield
property="contracts.{contractIterator.index}.room"
id="contract-{contract.uid}-room"
class="form-select"
class="form-control"
maxlength="100"
/>
</div>
Expand Down

0 comments on commit 3386f60

Please sign in to comment.