source: branches/version-2_5-dev/data/Smarty/templates/admin/order/multiple.tpl @ 20513

Revision 20513, 7.1 KB checked in by Seasoft, 13 years ago (diff)

#627(ソース整形・ソースコメントの改善)

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-smarty-template; charset=UTF-8
Line 
1<!--{*
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23*}-->
24<!--{include file="`$smarty.const.TEMPLATE_ADMIN_REALDIR`admin_popup_header.tpl"}-->
25
26<script type="text/javascript">
27<!--
28self.moveTo(20,20);self.focus();
29$(function() {
30
31    var product_class_id = window.opener.jQuery('input[id^=product_class_id]');
32    var product_code = window.opener.jQuery('input[id^=product_code]');
33    var product_name = window.opener.jQuery('input[id^=product_name]');
34    var classcategory_name1 = window.opener.jQuery('input[id^=classcategory_name1]');
35    var classcategory_name2 = window.opener.jQuery('input[id^=classcategory_name2]');
36    var price = window.opener.jQuery('input[id^=price]');
37    var quantity = window.opener.jQuery('input[id^=quantity]');
38    var shipping_id = window.opener.jQuery('input[id^=shipping_id]');
39    var shipping_name01 = window.opener.jQuery('input[name^=shipping_name01]');
40    var shipping_name02 = window.opener.jQuery('input[name^=shipping_name02]');
41    var shipping_pref = window.opener.jQuery('select[name^=shipping_pref] option:selected');
42    var shipping_addr01 = window.opener.jQuery('input[name^=shipping_addr01]');
43    var shipping_addr02 = window.opener.jQuery('input[name^=shipping_addr02]');
44
45    // 都道府県の入力チェック
46    shipping_pref.each(function() {
47        if (!$(this).val()) {
48            alert('お届け先住所が入力されていません。');
49            window.close();
50            return;
51        }
52    });
53
54    var index = 0;
55    for (var i = 0; i < product_class_id.length; i++) {
56
57        for (var j = 0; j < $(quantity[i]).val(); j++) {
58
59            // 表示商品名
60            var dispname = '';
61
62            // 商品規格ID
63            var idfield = $('<input type="hidden" />')
64                .attr({'name': 'multiple_product_class_id[' + index + ']'})
65                .val($(product_class_id[i]).val());
66
67            // 商品コード
68            var codefield = $('<input type="hidden" />')
69                .attr({'name': 'multiple_product_code['+ index + ']'})
70                .val($(product_code[i]).val());
71
72            // 商品名
73            var namefield = $('<input type="hidden" />')
74                .attr({'name': 'multiple_product_name[' + index + ']'})
75                .val($(product_name[i]).val());
76            dispname = $(product_name[i]).val();
77
78            // 規格1
79            var class1field = $('<input type="hidden" />')
80                .attr({'name': 'multiple_classcategory_name1[' + index + ']'})
81                .val($(classcategory_name1[i]).val());
82
83            if ($(classcategory_name1[i]).val() != '') {
84                dispname += '<br />' + $(classcategory_name1[i]).val();
85            }
86
87            // 規格2
88            var class2field = $('<input type="hidden" />')
89                .attr({'name': 'multiple_classcategory_name2[' + index + ']'})
90                .val($(classcategory_name2[i]).val());
91
92            if ($(classcategory_name2[i]).val() != '') {
93                dispname += '<br />' + $(classcategory_name2[i]).val();
94            }
95
96            // 単価
97            var pricefield = $('<input type="hidden" />')
98                .attr({'name': 'multiple_price[' + index + ']'})
99                .val($(price[i]).val());
100
101
102            // 数量
103            var qfield = $('<input type="text" />')
104                .attr({'name': 'multiple_quantity[' + index + ']',
105                       'size': 4})
106                .val(1);
107
108            // 数量と hidden を設定
109            var q = $('<td />').addClass('center')
110                .append(idfield)
111                .append(codefield)
112                .append(namefield)
113                .append(class1field)
114                .append(class2field)
115                .append(pricefield)
116                .append(qfield);
117
118            // お届け先
119            var select = $('<select />').attr('name', 'multiple_shipping_id[' + index + ']');
120            var s = $('<td />').append(select);
121
122            // 行を生成
123            var tr = $('<tr />')
124                .append($('<td />').text($(product_code[i]).val()))
125                .append($('<td />').html(dispname))
126                .append(q)
127                .append(s);
128
129            jQuery(tr).appendTo('tbody');
130            index++;
131        }
132    }
133
134    // プルダウンを生成
135    for (var i = 0; i < shipping_id.length; i++) {
136        var text = $(shipping_name01[i]).val() + $(shipping_name02[i]).val()
137            + ' ' + $(shipping_pref[i]).text()
138            + $(shipping_addr01[i]).val() + $(shipping_addr02[i]).val();
139        var option = $('<option />')
140            .val($(shipping_id[i]).val())
141            .text(text);
142        $('select').append(option);
143    }
144});
145
146function func_submit() {
147    var err_text = '';
148    var fm = window.opener.document.form1;
149
150    fm.mode.value = 'multiple_set_to';
151    fm.anchor_key.value = 'shipping';
152
153    var div = $('<div />');
154    $('input[name^=multiple_], select[name^=multiple_]').each(function() {
155        // TODO タグをベタ書きにしないと, innerHTML で value が空になってしまう
156        $(div).append('<input type="hidden" name="'
157                      + $(this).attr('name')
158                      + '" value="' + $(this).val() + '" />');
159    });
160
161    // window.opener に対する append は IE で動作しない
162    window.opener.jQuery('#multiple').html(div.html());
163    fm.submit();
164    window.close();
165    return true;
166}
167//-->
168</script>
169
170<!--▼検索フォーム-->
171<form name="form1" id="form1" method="post" action="<!--{$smarty.server.REQUEST_URI|h}-->">
172<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
173<input name="mode" type="hidden" value="search" />
174<input name="anchor_key" type="hidden" value="" />
175<input name="search_pageno" type="hidden" value="" />
176<input name="no" type="hidden" value="<!--{$tpl_no}-->" />
177<table summary="配送情報" class="list">
178    <thead>
179        <tr>
180            <th>商品コード</th>
181            <th>商品名/規格1/規格2</th>
182            <th>数量</th>
183            <th>お届け先</th>
184        </tr>
185    </thead>
186    <tbody>
187    </tbody>
188</table>
189<div class="btn-area">
190    <ul>
191        <li><a class="btn-action" href="javascript:;" onclick="func_submit(); return false;"><span class="btn-next">決定</span></a></li>
192    </ul>
193</div>
194</form>
195<!--{include file="`$smarty.const.TEMPLATE_ADMIN_REALDIR`admin_popup_footer.tpl"}-->
Note: See TracBrowser for help on using the repository browser.