<?php

    $fd = $_view["formData"];
    $company = $_view["company"];
?>

<div class="main-container interview space-mt-xl space-mb-md">
    <h1 class="headline medium space-mb-sm">Außendarstellung</h1>
    <p>Hier haben Sie die Möglichkeit, Informationen festzulegen, die auf Ihrer öffentlichen Unternehmensseite erscheinen sollen.</p>
    <p><a href="<?= $company->getLink(); ?>" class="btn sm btn-secondary" target="_blank">Unternehmensseite aufrufen</a></p>
    <form method="post" id="interviewForm" class="validateForm" action="<?= $_con->getLink(["company", "profileForm"]); ?>" enctype="multipart/form-data">
        <div class="row g-c space-mt-sm">
        <div class="col-lg-12">
        <div class="score-box">
                <input type="hidden" name="step" value="company">
                <label for="url" class="form-label mt-0">Webseite</label>
                <div class="input-group">
                    <input type="text" class="form-control required requiredIfSet requiredUrl" 
                    name="url" id="url" placeholder="z.B. https://www.musterfirma.biz" value="<?= sanitizeFormInput($fd["url"] ?? ""); ?>">
                </div>
                <div class="form-text form-error d-none">Bitte geben Sie die URL Ihrer der öffentlichen Webseite Ihres Unternehmens an</div>

                <label for="emailPublic" class="form-label">Öffentliche E-Mailadresse</label>
                <div class="input-group">
                    <input type="text" class="form-control required requiredIfSet requiredEmail" name="emailPublic" id="emailPublic" 
                    placeholder="z.B. info@musterfirma.biz" value="<?= sanitizeFormInput($fd["emailPublic"] ?? ""); ?>">
                </div>
                <div class="form-text form-error d-none">Bitte geben Sie die allgemeine Kontaktadresse Ihers Unternehmens an.</div>

                <label for="description" class="form-label">Unternehmensbeschreibung</label>
                <div class="input-group">
                    <textarea name="description" class="form-control" rows="5" place="maximal 1000 Zeichen"><?= sanitizeFormInput($fd["description"] ?? ""); ?></textarea>
                </div>
        </div>
        </div>
        <div class="col-lg-6">
        <?php $imageLogo = $company->getImageLink("logo", 220); ?>
        <div class="score-box h-100">
        <div class="row mb-3">
            <div class="col">
                <label for="imageLogo" class="form-label mt-0">Firmenlogo</label>
                <div class="input-group space-mb-sm">
                    <input type="file" name="imageLogo" class="form-control" accept="image/jpeg, image/png, image/webp">
                </div>
                <?php if ($imageLogo) { ?>
                    <div class="form-check space-mb-sm">
                        <input class="form-check-input std" type="checkbox" id="deleteImageLogo" name="deleteImage[]" value="logo"> 
                        <label for="deleteImageLogo" class="form-check-label std">Bestehendes Bild löschen</label>
                    </div>
                <?php } ?>
            </div>
            <?php if ($imageLogo) { ?>
                <div class="col-sm-12">
                    <p class="txt-big"><b>Ihr Logo</b></p>
                    <img class="" src="<?= $imageLogo; ?>">
                </div>
            <?php } ?>
        </div>
</div>
  </div> 
            <div class="col-lg-6">
        <?php $imageDescription = $company->getImageLink("description", 220); ?>
            <div class="score-box h-100">
        <div class="row mb-3">
            <div class="col">
                <label for="imageDescription" class="form-label mt-0">Foto für Beschreibung</label>
                <div class="input-group space-mb-sm">
                    <input type="file" name="imageDescription" class="form-control" accept="image/jpeg, image/png, image/webp">
                </div>
                <?php if ($imageDescription) { ?>
                    <div class="form-check space-mb-sm">
                        <input  class="form-check-input std" type="checkbox" id="deleteImageDescription" name="deleteImage[]" value="description"> 
                        <label for="deleteImageDescription" class="form-check-label std">Bestehendes Bild löschen</label>
                    </div>
                <?php } ?>
            </div>
            <?php if ($imageDescription) { ?>
                <div class="col-sm-12">
                    <p class="txt-big"><b>Ihr Foto für Beschreibung</b></p>
                    <img class="" src="<?= $imageDescription; ?>">
                </div>
            <?php } ?>
        </div>
</div>
            </div>
         </div>
        <div class="row g-3 text-center space-mt-md">
            <div class="col-12">
                <div class="btn lg btn-primary score w-xs-100 ico right">
                <input type="submit"  name="continue" value="Daten übernehmen">Daten übernehmen<span class="icon"></span>
                </div>
            </div>
            <div class="col-12">
                <div class="btn sm btn-secondary w-xs-100 ico left">
                <span class="icon"></span>Formular zurücksetzen<input type="reset" name="reset" 
                    value="Formular zurücksetzen" onclick="return confirm('Sind Sie sicher? Alle Änderungen werden gelöscht.');">
                </div>
            </div>
        </div>
    </form>
</div>
