Skip to content

Commit

Permalink
Update module ui / ux
Browse files Browse the repository at this point in the history
  • Loading branch information
voltan committed Dec 12, 2015
1 parent d8aa665 commit a5e5ce6
Show file tree
Hide file tree
Showing 13 changed files with 1,024 additions and 14 deletions.
16 changes: 15 additions & 1 deletion asset/css/front.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ul.progtrckr {
margin: 0;
padding: 0;
list-style-type none;
list-style-type: none;
}

ul.progtrckr li {
Expand Down Expand Up @@ -70,4 +70,18 @@ ul.progtrckr li.progtrckr-todo:before {

#pi-order .finishBox .finishLogo {
padding-bottom: 20px;
}

.cart-product .panel-body {
padding: 5px;
}

.cart-product-list {
margin-bottom: 10px;
}

.cart-product-single {
border-bottom: 1px solid #ddd;
padding-bottom: 10px;
margin-bottom: 10px;
}
2 changes: 1 addition & 1 deletion config/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'meta' => array(
'title' => _a('Orders'),
'description' => _a('Manage order process and payment'),
'version' => '1.7.0',
'version' => '1.7.1',
'license' => 'New BSD',
'logo' => 'image/logo.png',
'readme' => 'docs/readme.txt',
Expand Down
2 changes: 2 additions & 0 deletions sql/mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ CREATE TABLE `{customer}` (
`time_create` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`time_update` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`status` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
`delivery` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`location` INT(10) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
KEY `status` (`status`),
Expand Down
6 changes: 4 additions & 2 deletions src/Api/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public function addCustomer($values)
{
// Set values
$values['time_update'] = $values['time_create'];
$values['state'] = 1;
$values['status'] = 1;
unset($values['user_note']);
// Save customer info
$customer = Pi::model('customer', $this->getModule())->createRow();
$customer->assign($values);
Expand All @@ -44,7 +45,8 @@ public function updateCustomer($values)
{
// Set values
$values['time_update'] = time();
$values['state'] = 1;
$values['status'] = 1;
unset($values['user_note']);
// Find customer info
$customer = Pi::model('customer', $this->getModule())->find($values['customer_id']);
// Check customer
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function orderStatus($status)
break;

case '7':
$return['orderClass'] = 'btn-inverse';
$return['orderClass'] = 'btn-primary';
$return['orderTitle'] = __('Orders finished');
break;
}
Expand Down
18 changes: 16 additions & 2 deletions src/Controller/Front/CheckoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use Pi\Mvc\Controller\ActionController;
use Module\Order\Form\OrderForm;
use Module\Order\Form\OrderFilter;
use Module\Order\Form\OrderSimpleForm;
use Module\Order\Form\OrderSimpleFilter;
use Zend\Json\Json;

class CheckoutController extends IndexController
Expand Down Expand Up @@ -293,13 +295,15 @@ public function indexAction()
// Set new form
$user = Pi::api('user', 'order')->getUserInformation();
$user['customer_id'] = 0;
$forms = array();
$forms['new'] = new OrderForm('order', $option);
$forms['new']->setData($user);
// Set customer forms
if (!empty($customers)) {
foreach ($customers as $customer) {
$key = sprintf('customer-%s', $customer['id']);
$forms[$key] = new OrderForm('order', $option);
$option['location'] = $customer['location'];
$forms[$key] = new OrderSimpleForm('order', $option);
$forms[$key]->setData($data);
}
}
Expand All @@ -308,13 +312,17 @@ public function indexAction()
// Set new form
$user = Pi::api('user', 'order')->getUserInformation();
$user['customer_id'] = 0;
$forms = array();
$forms['new'] = new OrderForm('order', $option);
$forms['new']->setData($user);
// Set customer forms
if (!empty($customers)) {
foreach ($customers as $customer) {
$key = sprintf('customer-%s', $customer['id']);
$forms[$key] = new OrderForm('order', $option);
$option['location'] = $customer['location'];
unset($customer['delivery']);
unset($customer['user_note']);
$forms[$key] = new OrderSimpleForm('order', $option);
$forms[$key]->setData($customer);
}
}
Expand All @@ -324,6 +332,7 @@ public function indexAction()
$price['discount'] = 0;
$price['shipping'] = 0;
$price['packing'] = 0;
$price['setup'] = 0;
$price['vat'] = 0;
$price['total'] = 0;
foreach ($cart['product'] as $product) {
Expand Down Expand Up @@ -357,6 +366,11 @@ public function indexAction()
$plan = Pi::api('installment', 'order')->setPriceForInvoice($price['total'], $cart['plan'], $user);
$this->view()->assign('plan', $plan);
}
// Set products
foreach ($cart['product'] as $product) {
$cart['product'][$product['product']]['details'] = Pi::api('order', $cart['module_name'])->getProductDetails($product['product']);
$cart['product'][$product['product']]['product_price_view'] = Pi::api('api', 'order')->viewPrice($product['product_price']);
}
// Set view
$this->view()->setTemplate('checkout');
$this->view()->assign('forms', $forms);
Expand Down
48 changes: 48 additions & 0 deletions src/Form/Element/Delivery.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* Pi Engine (http://pialog.org)
*
* @link http://code.pialog.org for the Pi Engine source repository
* @copyright Copyright (c) Pi Engine http://pialog.org
* @license http://pialog.org/license.txt New BSD License
*/

/**
* @author Hossein Azizabadi <[email protected]>
*/

namespace Module\Order\Form\Element;

use Pi;
use Zend\Form\Element\Select;

class Delivery extends Select
{
/**
* @return array
*/
public function getValueOptions()
{
if (empty($this->valueOptions)) {
$list = array();
$where = array('location' => $this->options['location']);
$select = Pi::model('location_delivery', 'order')->select()->where($where);
$rowset = Pi::model('location_delivery', 'order')->selectWith($select);
foreach ($rowset as $row) {
$delivery = Pi::model('delivery', 'order')->find($row->delivery)->toArray();
if ($delivery['status']) {
$list[$delivery['id']] = sprintf('%s - %s : %s - %s : %s %s' ,
$delivery['title'],
__('Price'),
Pi::api('api', 'order')->viewPrice($row->price),
__('Time'),
_number($row->delivery_time),
__('Days')
);
}
}
$this->valueOptions = $list;
}
return $this->valueOptions;
}
}
7 changes: 3 additions & 4 deletions src/Form/OrderForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public function init()
),
'attributes' => array(
'id' => 'select-delivery',
'size' => 5,
'size' => 3,
'required' => true,
)
));
Expand All @@ -332,7 +332,7 @@ public function init()
),
'attributes' => array(
'id' => 'select-payment',
'size' => 5,
'size' => 3,
'required' => true,
)
));
Expand Down Expand Up @@ -369,7 +369,6 @@ public function init()
break;

case 'service':
$gatewayList = Pi::api('gateway', 'order')->getActiveGatewayName();
if (count($gatewayList) == 1) {
$gatewayList = array_keys($gatewayList);
// gateway
Expand Down Expand Up @@ -466,7 +465,7 @@ public function init()
'type' => 'submit',
'attributes' => array(
'value' => $title,
'class' => 'btn btn-primary',
'class' => 'btn btn-success',
)
));
}
Expand Down
Loading

0 comments on commit a5e5ce6

Please sign in to comment.