<?php
/**
* Product: Katyshop
* @version 0.3.2.1
* @author Catalin Hulea - hide@address.com
* @copyright Copyright (C) 2007 Catalin Hulea
* @license GNU General Public License version 3
* You can find a copy of GNU GPL v3 at this path: /docs/LICENSE
* @link https://sourceforge.net/projects/katyshop
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
require_once(dirname(__FILE__) . "/init.php");
require_once(WEB_DIR . "/includes/req_person_company.php");
?>
<html>
<head>
<title><?php echo APP_NAME; ?></title>
<?php require_once(WEB_DIR . "/includes/html_head.php"); ?>
</head>
<body>
<div id="container">
<?php require_once(WEB_DIR . "/includes/header.php"); ?>
<div id="middle">
<div id="left_vertical_line">
<?php require_once(WEB_DIR . "/includes/left.php"); ?>
<div id="content">
<h1>Cos de cumparaturi</h1>
<?php require_once(WEB_DIR . "/includes/print_messages.php"); ?>
<dl>
<dt class="title"><b>Cos de cumparaturi</b></dt>
<dd>
<?php
$db = Application::getDb();
$user = Application::getUser();
$pageTitle = "";
$noAddressText = "";
$list = array();
if(@$_GET["action"] == "select_delivery_address")
{
$pageTitle = "Selectati adresa de livrare";
$noAddressText = "de livrare";
$list = $db->tbAddress->getRecordsByUserId($user->id, "delivery");
}
elseif(@$_GET["action"] == "select_invoice_address")
{
$pageTitle = "Selectati adresa de livrare";
$noAddressText = "de facturare";
$list = $db->tbAddress->getRecordsByUserId($user->id, "invoiceing");
}
?>
<b><?php echo $pageTitle; ?>:</b><br>
<?php
if(count($list) > 0)
{
?>
<form action="formparser/order.php?action=<?php echo Escape::htmlValue(@$_GET["action"]); ?>" method="post" id="frm_select_address">
<input type="hidden" name="id_address" value="0">
</form>
<?php
for($i = 0; $i < count($list); $i++)
{
$a = $list[$i];
?>
<dl>
<dt></dt>
<dd>
<table style="border-bottom: 1px solid #000000; width: 375px; ">
<tr valign="top">
<td width="150">
<input type="checkbox" <?php echo ($a->primary_addr == 1) ? "checked" : ""; ?> disabled> Adresa primara<br>
<input type="checkbox" <?php echo ($a->delivery == 1) ? "checked" : ""; ?> disabled> Livrare<br>
<input type="checkbox" <?php echo ($a->invoiceing == 1) ? "checked" : ""; ?> disabled> Facturare<br>
<form action="formparser/order.php?action=<?php echo Escape::htmlValue(@$_GET["action"]); ?>" method="post">
<input type="hidden" name="id_address" value="<?php echo intval($a->id); ?>">
<input type="submit" value="Selectati" class="button">
</form>
</td>
<td>
<a href="javascript:selectOrderAddress('<?php echo $a->id; ?>'); ">Judet <?php echo $a->county; ?></a><br>
<a href="javascript:selectOrderAddress('<?php echo $a->id; ?>'); ">Oras <?php echo $a->city; ?></a><br>
<a href="javascript:selectOrderAddress('<?php echo $a->id; ?>'); "><?php echo $a->address; ?></a>
</td>
</tr>
</table>
</dl>
<?php
}
if(@$_GET["action"] == "select_delivery_address")
{
?>
<input type="button" value="« Inapoi" onclick="window.open('shopping_cart.php', '_self'); " class="button">
<?php
}
elseif (@$_GET["action"] == "select_invoice_address")
{
?>
<input type="button" value="« Inapoi" onclick="window.open('shopping_cart_address.php?action=select_delivery_address', '_self'); " class="button">
<?php
}
}
else
{
?>
<p style="background-color: white; ">
Nici o adresa <?php echo $noAddressText; ?> nu a putut fi gasita.
<a href="address.php?detail=true&id=0">Click aici</a>
pentru a adauga o noua adresa <?php echo $noAddressText; ?> in address book.
</p>
<?php
}
?>
</dd>
</dl>
</div>
<?php require_once(WEB_DIR . "/includes/right.php"); ?>
<?php require_once(WEB_DIR . "/includes/footer.php"); ?>
</div>
</div>
</div>
</body>
</html>