source: branches/version-2_12-multilang/data/Smarty/templates/admin/basis/holiday.tpl @ 22456

Revision 22456, 7.9 KB checked in by m_uehara, 8 years ago (diff)

#1987 日付取得処理修正

  • 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-2012 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
25<script type="text/javascript">
26<!--
27$(function(){
28        var dateFormat = $.datepicker.regional['<!--{$smarty.const.LANG_CODE}-->'].dateFormat;
29       
30        <!--{if $arrForm.month != '' && $arrForm.day != ''}-->
31        var year  = new Date().getFullYear();
32        var month = '<!--{$arrForm.month|h}-->';
33        var day   = '<!--{$arrForm.day|h}-->';
34        var ymd = $.datepicker.formatDate(dateFormat, new Date(year, month - 1, day));
35        $("#datepicker").val(ymd);
36        // console.log(ymd);
37        <!--{/if}-->
38
39        $( "#datepicker" ).datepicker({
40        beforeShowDay: function(date) {
41            if(date.getDay() == 0) {
42                return [true,"date-sunday"];
43            } else if(date.getDay() == 6){
44                return [true,"date-saturday"];
45            } else {
46                return [true];
47            }
48        },changeMonth: 'true'
49        ,changeYear: 'false'
50        ,onSelect: function(dateText, inst){
51            var year  = inst.selectedYear;
52            var month = inst.selectedMonth + 1;
53            var day   = inst.selectedDay;
54            setDate(year + '/' + month + '/' + day);
55        },
56        showButtonPanel: true,
57        beforeShow: showAdditionalButton,       
58        onChangeMonthYear: showAdditionalButton
59        });
60       
61        $("#datepicker").change( function() {
62            var dateText   = $(this).val();
63            var dateFormat = $.datepicker.regional['<!--{$smarty.const.LANG_CODE}-->'].dateFormat;
64            // console.log(dateText);
65            // console.log(dateFormat);
66            var date;
67            var year  = '';
68            var month = '';
69            var day   = '';
70            try {
71                date = $.datepicker.parseDate(dateFormat, dateText);
72                year  = date.getFullYear();
73                month = date.getMonth() + 1;
74                day   = date.getDate();
75            } catch (e) {
76                // console.log(e);
77                // clear date text
78                $(this).val('');
79            }
80            setDate(year + '/' + month + '/' + day);
81        });
82       
83    });
84   
85    var btn = $('<button class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" type="button">Clear</button>');
86   
87    var showAdditionalButton = function (input) {
88        setTimeout(function () {
89            var buttonPane = $(input)
90                     .datepicker("widget")
91                     .find(".ui-datepicker-buttonpane");
92            btn
93                    .unbind("click")
94                    .bind("click", function () {
95                        $.datepicker._clearDate(input);
96                        $("*[name=year]").val("");
97                        $("*[name=month]").val("");
98                        $("*[name=day]").val("");
99                    });
100            btn.appendTo(buttonPane);
101        }, 1);
102    };
103   
104    function setDate(dateText){
105    var dates = dateText.split('/');
106    $("*[name=year]").val(dates[0]);
107    $("*[name=month]").val(dates[1]);
108    $("*[name=day]").val(dates[2]);
109    }
110//-->
111</script>
112
113<form name="form1" id="form1" method="post" action="?">
114<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
115<input type="hidden" name="mode" value="edit" />
116<input type="hidden" name="holiday_id" value="<!--{$tpl_holiday_id}-->" />
117<div id="basis" class="contents-main">
118
119    <table class="form">
120        <tr>
121            <th><!--{t string="tpl_Title<span class='attention'> *</span>_01" escape="none"}--></th>
122            <td>
123                <!--{if $arrErr.title}--><span class="attention"><!--{$arrErr.title}--></span><!--{/if}-->
124                <input type="text" name="title" value="<!--{$arrForm.title|h}-->" maxlength="<!--{$smarty.const.SMTEXT_LEN}-->" style="" size="60" class="box60"/>
125                <span class="attention"> <!--{t string="tpl_(T_ARG1 characters max)_01" T_ARG1=$smarty.const.SMTEXT_LEN}--></span>
126            </td>
127        </tr>
128        <tr>
129            <th><!--{t string="tpl_Date<span class='attention'> *</span>_01" escape="none"}--></th>
130            <td>
131                <!--{if $arrErr.date || $arrErr.month || $arrErr.day}-->
132                <span class="attention"><!--{$arrErr.date}--></span>
133                <span class="attention"><!--{$arrErr.month}--></span>
134                <span class="attention"><!--{$arrErr.day}--></span>
135                <!--{/if}-->
136                <input id="datepicker" type="text" value="" <!--{if $arrErr.year != ""}--><!--{sfSetErrorStyle}--><!--{/if}--> />
137                <input type="hidden" name="month" value="<!--{$arrForm.month}-->" />
138                <input type="hidden" name="day" value="<!--{$arrForm.day}-->" />
139                <br />
140                <span class="attention"><!--{t string="tpl_Compensating holidays are not automatically set. Set the dates for compensating holidays._01"}--></span>
141            </td>
142        </tr>
143    </table>
144
145    <div class="btn-area">
146        <ul>
147            <li><a class="btn-action" href="javascript:;" onclick="fnFormModeSubmit('form1', 'edit', '', ''); return false;"><span class="btn-next"><!--{t string="tpl_Save and continue_01"}--></span></a></li>
148        </ul>
149    </div>
150
151    <table class="list">
152        <col width="50%" />
153        <col width="20%" />
154        <col width="10%" />
155        <col width="10%" />
156        <col width="20%" />
157        <tr>
158            <th><!--{t string="tpl_Title_01"}--></th>
159            <th><!--{t string="tpl_Date_01"}--></th>
160            <th class="edit"><!--{t string="tpl_Edit_01"}--></th>
161            <th class="delete"><!--{t string="tpl_Remove_01"}--></th>
162            <th><!--{t string="tpl_Move_01"}--></th>
163        </tr>
164        <!--{section name=cnt loop=$arrHoliday}-->
165        <tr style="background:<!--{if $tpl_holiday_id != $arrHoliday[cnt].holiday_id}-->#ffffff<!--{else}--><!--{$smarty.const.SELECT_RGB}--><!--{/if}-->;">
166            <!--{assign var=holiday_id value=$arrHoliday[cnt].holiday_id}-->
167            <td><!--{$arrHoliday[cnt].title|h}--></td>
168            <td><!--{t string="tpl_T_ARG1/T_ARG2_01" T_ARG1=$arrHoliday[cnt].month|h T_ARG2=$arrHoliday[cnt].day|h}--></td>
169            <td class="center">
170                <!--{if $tpl_holiday_id != $arrHoliday[cnt].holiday_id}-->
171                <a href="?" onclick="fnModeSubmit('pre_edit', 'holiday_id', <!--{$arrHoliday[cnt].holiday_id}-->); return false;"><!--{t string="tpl_Edit_01"}--></a>
172                <!--{else}-->
173                <!--{t string="tpl_being edited_01"}-->
174                <!--{/if}-->
175            </td>
176            <td class="center">
177                <!--{if $arrClassCatCount[$class_id] > 0}-->
178                -
179                <!--{else}-->
180                <a href="?" onclick="fnModeSubmit('delete', 'holiday_id', <!--{$arrHoliday[cnt].holiday_id}-->); return false;"><!--{t string="tpl_Remove_01"}--></a>
181                <!--{/if}-->
182            </td>
183            <td class="center">
184                <!--{if $smarty.section.cnt.iteration != 1}-->
185                <a href="?" onclick="fnModeSubmit('up', 'holiday_id', <!--{$arrHoliday[cnt].holiday_id}-->); return false;" /><!--{t string="tpl_To top_01"}--></a>
186                <!--{/if}-->
187                <!--{if $smarty.section.cnt.iteration != $smarty.section.cnt.last}-->
188                <a href="?" onclick="fnModeSubmit('down', 'holiday_id', <!--{$arrHoliday[cnt].holiday_id}-->); return false;" /><!--{t string="tpl_To bottom_01"}--></a>
189                <!--{/if}-->
190            </td>
191        </tr>
192        <!--{/section}-->
193    </table>
194
195</div>
196</form>
Note: See TracBrowser for help on using the repository browser.