<?php
/**
 * @copyright 2021 Double Bastion LLC <www.doublebastion.com>
 *
 * @author Double Bastion LLC
 *
 * @license GNU AGPL version 3 or any later version
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

declare(strict_types=1);

script('pax_fax', 'sendfax');
style('pax_fax', 'style');

?>

<div id="pax_fax_vbar">

       <div id="currentbaldiv"><a class="providername" href="https://console.phaxio.com/sf_guard_users/sign_in" target="_blank" rel="noreferrer noopener">Phaxio</a> balance:
            <span id="currentbalance"></span>
            <button id="checkbalance" title="Refresh to see the current balance."></button>
       </div>

       <div id="faxnumbersdiv" class="cllridcls">
            <div id="pickid">Set ID:</div>
            <select id="currentfaxnmbrs" class="optselectfxnb">
               <option value="" selected="selected" disabled hidden class="optselectfxnb">click refresh button</option>
            </select>
            <button id="selectcalleridbttn" title="Refresh the list of Sender IDs."></button>
            <div class="fortooltipinit">
                 <div id="infosetid">i</div>
                 <span class="calleridtooltip">The Caller ID is the 'from' number that the receiver sees on the fax that you send. You can leave it blank or you can set as
                       Caller ID one of your Phaxio fax numbers (first refresh the list, then select from the drop-down)
                 </span>
            </div>
       </div>

       <div  class="pfheader">
            Enter the recipient's number as:
       </div>
       <div class="faxnbformat">
            <a id="countryCallCode" href="https://en.wikipedia.org/wiki/List_of_country_calling_codes#Alphabetical_listing_by_country_or_region"
               target="_blank" rel="noreferrer noopener">country_calling_code</a><font style="color:#aa2e4b">fax_number</font>
       </div>
       <div class="fortooltip">
         <div id="infonumber">i</div>
         <span class="fortooltiptext">
            For example, to send a fax to the German fax number 1212121212 you must enter 491212121212, where 49 is the code of Germany. (For US the calling
            code is 1, for UK 44, for France 33, etc.) The <a href="https://en.wikipedia.org/wiki/List_of_country_calling_codes#Alphabetical_listing_by_country_or_region"
            target="_blank" rel="noreferrer noopener" style="color:#1b60ba">country calling code</a> must be always included, even if the fax is sent locally. 
            The '+' sign will be added automatically, so, no need to add '+' or '00' in front of the number. If you want to send the same fax simultaneously to multiple numbers,
            add them one after the other separated by a comma like this: 497777777777,442222222222 You can send a fax to up to 15 numbers at once.
         </span>
       </div>

   <div id="faxtodiv">
       <input type="text" id="faxto" name="faxto" />
   </div>

   <div class="pfheader">Choose the document(s) that you want to send as fax:
   </div>
       <div class="fortooltipsec">
          <div id="infoformat">i</div>
          <span class="fortooltiptextsec">
              Supported formats are: pdf, odt, jpg, png, txt, tif, tiff, html, doc, docx. You can send up to 20 files with a cumulative size of up to 20 MB and up to 200 pages, in one fax call. (docx/doc files can be sent as fax but can't be previewed in the adjoining preview pane; please preview docx/doc files outside this application before sending them as fax).
          </span>
       </div>

       <div id="filestotsize">Total files size:<span id="filessizetext"></span></div>

       <div id="fileuploadednm" class="fileuploadstl"></div>
       <div class="uploadfiledv">
            <form class="uploadflbt"  enctype="multipart/form-data" >
                  <span id="uploadFile">Upload a file</span>
                  <input id="uploadfileforfax" class="fileupload" name="uploadedtofax[]" type="file" multiple />
                  <label for="uploadfileforfax" class="button icon-upload svg" id="uploadfileforfax" </label>
            </form>
       </div>

    <span id="pf_upload_msg"></span>

    <div id="filespickednc" class="filesfromnc"></div>
  
    <span id="pickFromNext">Pick from Nextcloud</span>

    <button id="choosefilen"></button>

    <span id="pf_choose_msg"></span>

    <p class="pickedflnm"></p>

    <input type="submit" id="submitfax" value="Send Fax" />

    <span id="pf_submit_msg"></span>

    <div id="dirbuttons">
       <button id="receivedfaxdir" class="openfaxfolder">Received Faxes</button>
       <button id="sentfaxdir" class="openfaxfolder">Sent Faxes</button>
       <button id="receivedfaileddir" class="openfaxfolder">Failed Received Faxes</button>
       <button id="sentfaileddir" class="openfaxfolder">Failed Sent Faxes</button>
    </div>

</div>
