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

Revision 20516, 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({
105                    'name': 'multiple_quantity[' + index + ']',
106                    'size': 4
107                })
108                .val(1);
109
110            // 数量と hidden を設定
111            var q = $('<td />').addClass('center')
112                .append(idfield)
113                .append(codefield)
114                .append(namefield)
115                .append(class1field)
116                .append(class2field)
117                .append(pricefield)
118                .append(qfield);
119
120            // お届け先
121            var select = $('<select />').attr('name', 'multiple_shipping_id[' + index + ']');
122            var s = $('<td />').append(select);
123
124            // 行を生成
125            var tr = $('<tr />')
126                .append($('<td />').text($(product_code[i]).val()))
127                .append($('<td />').html(dispname))
128                .append(q)
129                .append(s);
130
131            jQuery(tr).appendTo('tbody');
132            index++;
133        }
134    }
135
136    // プルダウンを生成
137    for (var i = 0; i < shipping_id.length; i++) {
138        var text = $(shipping_name01[i]).val() + $(shipping_name02[i]).val()
139            + ' ' + $(shipping_pref[i]).text()
140            + $(shipping_addr01[i]).val() + $(shipping_addr02[i]).val();
141        var option = $('<option />')
142            .val($(shipping_id[i]).val())
143            .text(text);
144        $('select').append(option);
145    }
146});
147
148function func_submit() {
149    var err_text = '';
150    var fm = window.opener.document.form1;
151
152    fm.mode.value = 'multiple_set_to';
153    fm.anchor_key.value = 'shipping';
154
155    var div = $('<div />');
156    $('input[name^=multiple_], select[name^=multiple_]').each(function() {
157        // TODO タグをベタ書きにしないと, innerHTML で value が空になってしまう
158        $(div).append('<input type="hidden" name="'
159            + $(this).attr('name')
160            + '" value="' + $(this).val() + '" />');
161    });
162
163    // window.opener に対する append は IE で動作しない
164    window.opener.jQuery('#multiple').html(div.html());
165    fm.submit();
166    window.close();
167    return true;
168}
169//-->
170</script>
171
172<!--▼検索フォーム-->
173<form name="form1" id="form1" method="post" action="<!--{$smarty.server.REQUEST_URI|h}-->">
174<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
175<input name="mode" type="hidden" value="search" />
176<input name="anchor_key" type="hidden" value="" />
177<input name="search_pageno" type="hidden" value="" />
178<input name="no" type="hidden" value="<!--{$tpl_no}-->" />
179<table summary="配送情報" class="list">
180    <thead>
181        <tr>
182            <th>商品コード</th>
183            <th>商品名/規格1/規格2</th>
184            <th>数量</th>
185            <th>お届け先</th>
186        </tr>
187    </thead>
188    <tbody>
189    </tbody>
190</table>
191<div class="btn-area">
192    <ul>
193        <li><a class="btn-action" href="javascript:;" onclick="func_submit(); return false;"><span class="btn-next">決定</span></a></li>
194    </ul>
195</div>
196</form>
197<!--{include file="`$smarty.const.TEMPLATE_ADMIN_REALDIR`admin_popup_footer.tpl"}-->
Note: See TracBrowser for help on using the repository browser.