# Copyright (c) 2001-2009 bivio Software, Inc. All rights reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library 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 # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: order-commit.bview,v 2.5 2009/11/28 02:59:08 nagler Exp $ # # Order detail # view_parent('menu'); view_put( header_title => 'Order Shipped', header_page_print => 1, ); # Returns a address widget which renders the specified Address. my($address_widget) = sub { my($heading, $location) = @_; $location = Bivio::Type::Location->from_name($location); return Join([ String($heading, 'page_heading'), '

', String($location->get_short_desc), String(':'), '
', String(['Model.Order', lc($location->get_name) . '_name']), '
', [sub { my($req) = @_; Bivio::Biz::Model->new($req, 'Address')->load({ location => $location, }), return ''; }], String(['Model.Address', 'street1']), '
', If(['Model.Address', 'street2'], Join([String(['Model.Address', 'street2']), '
',]), Join([''])), String(['Model.Address', 'city']), String(', '), String(['Model.Address', 'state']), vs_blank_cell(2), String(['Model.Address', 'zip']), '

', ])->put(string_font => 'page_text'); }; # renders the last four digits of the credit card my($card_number) = sub { my($source, $number) = @_; return '***********' . substr($number, -4, 4); }; view_put(menu_content => Grid([ [ Join([ String('Date: ', 'page_heading'), String(['Model.ECPayment', 'creation_date_time', 'HTMLFormat.Date']), ]), ], [ Join([ String('Email: ', 'page_heading'), String(['Model.Email', 'email']), '
', ]), ], [ String('Order Information:', 'page_heading'), ], [ Join([ String('Order ID: ', 'form_field_label'), String(['Model.Order', 'order_id']), '
', ]), ], [ Table('CartItemList', [ 'Item.item_id', ['item_name', { wf_list_link => { query => 'THIS_CHILD_LIST', task => 'ITEM_DETAIL', }, }], 'CartItem.unit_price', 'CartItem.quantity', 'total_cost', ], { cellpadding => 2, cellspacing => 2, footer_row_widgets => [ String('Total:', 'table_heading'), vs_blank_cell()->put(column_span => 3), TableSummaryCell({ field => 'total_cost', string_font => 'table_heading', }), ], }), ], [ $address_widget->('Shipping Information:', 'SHIP_TO'), ], [ $address_widget->('Billing Information:', 'BILL_TO'), ], [ String('Credit Card Information:', 'page_heading'), ], [ Grid([ [ String('Number: '), String([$card_number, ['Model.ECCreditCardPayment', 'card_number']]), ], [ String('Expiration Date: '), CreditCardExpiration({ value => ['Model.ECCreditCardPayment', 'card_expiration_date'], }), ], ], { pad => 2, }), ], [ Join([ String('Status: ', 'page_heading'), String([['Model.ECPayment', 'status'], '->get_short_desc']), ]), ], ], { space => 12, string_font => 'page_text', })); view_pre_execute(sub { my($req) = @_; Bivio::Biz::Model->new($req, 'Email')->unauth_load_or_die({ realm_id => $req->get('auth_user_id'), location => Bivio::Type::Location->PRIMARY, }); });