<?php

use App\Utils\Page;
?>

<div class="w3-row soshot-main w3-margin-bottom">
  <div class="w3-container">
    <h1 class="w3-text-teal"><?= $this->title; ?></h1>
    <form class="w3-container" method="post">

      <p>
        <label>Accept only request from 127.0.0.1</label>
        <input class="w3-check" type="checkbox" name="onlyLocalServer" value="1" <?= Page::checked($this->conf->onlyLocalServer, true); ?>>
      </p>
      <p>
        <label>Use web GUI</label>
        <input class="w3-check" type="checkbox" name="webPage" value="1" <?= Page::checked($this->conf->webPage, true); ?>>
      </p>
      <p>
        <label>Use log</label>
        <input class="w3-check" type="checkbox" name="log" value="1" <?= Page::checked($this->conf->log, true); ?>>
      </p>
      <p>
        <label>Always make PDF</label>
        <input class="w3-check" type="checkbox" name="alwaysMakePdf" value="1" <?= Page::checked($this->conf->alwaysMakePdf, true); ?>>
      </p>
      <p>
        <label>Favicon size</label>
        <input class="w3-input w3-border" type="number" name="icoSize" value="<?= $this->conf->icoSize; ?>">
      </p>
      <p>
        <label>Permit type of webshot</label>
        <select class="w3-select w3-border" name="permitType[]" multiple size="7">
          <option value="fav" <?= Page::selected('fav', $this->conf->permitType); ?>>Favicon (<?= $this->conf->icoSize; ?>x<?= $this->conf->icoSize; ?>)</option>
          <option value="og" <?= Page::selected('og', $this->conf->permitType); ?>>Og image</option>
          <option value="pdf" <?= Page::selected('pdf', $this->conf->permitType); ?>>PDF</option>
          <option value="thumb" <?= Page::selected('thumb', $this->conf->permitType); ?>>ThumbShot (160x90)</option>
          <option value="hd" <?= Page::selected('hd', $this->conf->permitType); ?>>HD (1080x720)</option>
          <option value="full" <?= Page::selected('full', $this->conf->permitType); ?>>Full HD (1920x1080)</option>
          <option value="complete" <?= Page::selected('complete', $this->conf->permitType); ?>>Complete (1920x height of page)</option>
        </select>
      </p>
      <p>
        <label>Cache expiration (for web GUI) in hour</label>
        <input class="w3-input w3-border" type="number" name="expireCache" value="<?= $this->conf->expireCache; ?>">
      </p>
      <p>
        <label>Maximum work per batch</label>
        <input class="w3-input w3-border" type="number" name="maxGenPerBatch" value="<?= $this->conf->maxGenPerBatch; ?>">
      </p>

      <p>
        <label>Api key (<span class="w3-red">change key will be invalid all previous generation</span>)</label>
        <input class="w3-input w3-border" type="text" name="key" value="<?= $this->conf->key; ?>">
      </p>

      <p>
        <label>Password</label>
        <input class="w3-input w3-border" type="password" name="password" value="" <?= $this->passwordRequired; ?>>
      </p>

      <p>
        <label>Chrome path (if empty, SoShot use default value "chrome or chromium")</label>
        <input class="w3-input w3-border" type="text" name="chromePath" value="<?= $this->conf->chromePath; ?>">
      </p>

      <p>
        <input type="hidden" name="page" value="settings">
        <input type="hidden" name="token" value="<?= $token;?>">
        <button type="submit" class="w3-btn w3-padding w3-teal" style="width:120px">Save</button>
      </p>
    </form>
  </div>
</div>