diff --git a/app/assets/javascripts/admin.js b/app/assets/javascripts/admin.js index dde8bc823..0cab04359 100644 --- a/app/assets/javascripts/admin.js +++ b/app/assets/javascripts/admin.js @@ -9,6 +9,7 @@ //= require bootstrap-notify //= require jquery.cookie.min //= require select2 +//= require moment.min //= require jquery.cxselect //= require bootstrap-datepicker //= require bootstrap-datetimepicker diff --git a/app/assets/javascripts/admins/competition_settings/index.js b/app/assets/javascripts/admins/competition_settings/index.js index 11506cc0a..1efe301bc 100644 --- a/app/assets/javascripts/admins/competition_settings/index.js +++ b/app/assets/javascripts/admins/competition_settings/index.js @@ -9,7 +9,7 @@ $(document).on('turbolinks:load', function(){ }; var timeOptions = { - autoclose: true, + autoclose: 1, language: 'zh-CN', format: 'yyyy-mm-dd hh:ii:ss', minuteStep: 30 @@ -23,18 +23,12 @@ $(document).on('turbolinks:load', function(){ $(element).find('.end-date').datepicker('setStartDate', e.date); }); }; + $(".competition-start-end-date .start-date").datetimepicker(timeOptions); - // var defineTimeRangeSelect = function (element) { - // var options = $.extend({inputs: $(element).find('.start-date, .end-date')}, timeOptions); - // $(element).datetimepicker(options); - // - // $(element).find('.start-date').datetimepicker().on('changeDate', function (e) { - // $(element).find('.end-date').datetimepicker('setStartDate', e.date); - // }); - // }; + $(".competition-start-end-date .end-date").datetimepicker(timeOptions); defineDateRangeSelect('.teaching-mode-date'); - defineDateRangeSelect('.competition-start-end-date'); + // defineTimeRangeSelect('.competition-start-end-date'); var $basicForm = $('form.basic-setting-form'); @@ -59,13 +53,13 @@ $(document).on('turbolinks:load', function(){ if ($("input[name='mode']:checked").val() == 2) { var $courseId = $("input[name='course_id'"); - if ($courseId.val() === undefined || $course_id.val().length === 0) { + if ($courseId.val() === undefined || $courseId.val().length === 0) { $courseId.addClass('danger text-danger'); valid = false; } else { $courseId.removeClass('danger text-danger'); } - } else if ($("input[name='mode']:checked").val() == 4) { + } else if ($("input[name='mode']:checked").val() == 3) { var $techStartTime = $("input[name='teach_start_time'"); var $techEndTime = $("input[name='teach_end_time'"); if ($techStartTime.val() === undefined || $techStartTime.val().length === 0) { @@ -81,6 +75,10 @@ $(document).on('turbolinks:load', function(){ } else { $techEndTime.removeClass('danger text-danger'); } + } else { + $("input[name='course_id'").removeClass('danger text-danger'); + $("input[name='teach_start_time'").removeClass('danger text-danger'); + $("input[name='teach_end_time'").removeClass('danger text-danger'); } if (!valid) return; @@ -110,80 +108,80 @@ $(document).on('turbolinks:load', function(){ $(function () { //MD编辑 - $("#MD_typeFrom").on("click",".add_MD_type",function () { - - var length=$(".MD_type").find(".add_MD_type").length + 1; - var html='
\n' + - '
\n' + - ' \n' + - '
\n' + - '
\n' + - '
\n' + - ' \n' + - ' \n' + - '
'; - $("#MD_typeFrom").append(html); - }) - $("#MD_typeFrom").on("click",".del_MD_type",function () { - $(this).parents(".MD_type").remove(); - }) - + // $("#MD_typeFrom").on("click",".add_MD_type",function () { + // + // var length=$(".MD_type").find(".add_MD_type").length + 1; + // var html='
\n' + + // '
\n' + + // ' \n' + + // '
\n' + + // '
\n' + + // '
\n' + + // ' \n' + + // ' \n' + + // '
'; + // $("#MD_typeFrom").append(html); + // }) + // $("#MD_typeFrom").on("click",".del_MD_type",function () { + // $(this).parents(".MD_type").remove(); + // }) //链接 - $("#linkForm").on("click",".add_linkBtn",function () { - var length=$("#linkForm").find(".linkFormItem").length + 1; - var html='
\n' + + $(".nav-setting-form").on("click",".add_linkBtn",function () { + var length=$(".nav-setting-form").find(".linkFormItem").length + 1; + var html='
\n' + '
\n' + ' \n' + '
\n' + - '
\n' + - '
\n' + - '
\n' + - ' \n' + - ' \n' + - '
' - $("#linkForm").append(html) - }) - $("#linkForm").on("click",".del_linkBtn",function () { - $(this).parents(".lineFromItem").remove(); - }) + '
\n' + + '
\n' + + '
\n' + + '
\n' + + ' +\n' + + ' ×\n' + + '
'; + $(this).parents(".linkFormItem").after(html); + }); + + $(".nav-setting-form").on("click", ".del_linkBtn", function () { + $(this).parents(".linkFormItem").remove(); + }); //有关报名要求 - $("#addRequireBtn").on("click",function () { + $(".addRequireBtn").on("click",function () { var length=$("#requireForm").find(".requireForm_item").length + 1; var html='
\n' + '
  
\n' + '
\n' + - ' \n' + + ' \n' + '
\n' + ' ~\n' + '
\n' + - ' \n' + + ' \n' + '
\n' + ' \n' + '
\n' + - ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + ' \n' + '
\n' + '
\n' + ' \n' + '
\n' + '
\n' + ' \n' + ' \n' + @@ -192,12 +190,49 @@ $(function () { '
\n' + '
'; $("#requireForm").append(html); - }) + }); $("#requireForm").on("click",".delRequrieBtn",function () { $(this).parents(".requireForm_item").remove(); }) + $('.competition-staff-settings').on('click', '.mutiple-limited-radio', function(){ + var radio = $(this); + if (radio.is(':checked')) { + radio.parent().parent().siblings().find('.mutiple-limited-radio').attr('checked', false) + } else { + radio.parent().parent().siblings().find('.mutiple-limited-radio').attr('checked', true) + } + }); + + var $navForm = $('form.nav-setting-form'); + $navForm.on('click', ".submit-btn", function () { + $navForm.find('.submit-btn').attr('disabled', 'disabled'); + $navForm.find('.error').html(''); + var valid = $navForm.valid(); + + if (!valid) return; + $.ajax({ + method: 'POST', + dataType: 'json', + url: $navForm.attr('action'), + data: new FormData($navForm[0]), + processData: false, + contentType: false, + success: function (data) { + $.notify({message: '保存成功'}); + // window.location.reload(); + }, + error: function (res) { + var data = res.responseJSON; + $navForm.find('.error').html(data.message); + }, + complete: function () { + $navForm.find('.submit-btn').attr('disabled', false); + } + }); + }); + // 排行榜设置 @@ -340,4 +375,4 @@ function addNewTab() { '
'; $("#large_panel").append(html); -} \ No newline at end of file +} diff --git a/app/assets/javascripts/admins/laboratories/index.js b/app/assets/javascripts/admins/laboratories/index.js index abb7cb72d..689910446 100644 --- a/app/assets/javascripts/admins/laboratories/index.js +++ b/app/assets/javascripts/admins/laboratories/index.js @@ -135,7 +135,7 @@ $(document).on('turbolinks:load', function() { }, templateResult: function (item) { if(!item.id || item.id === '') return item.text; - return item.real_name; + return $("" + item.real_name + " " + item.school_name + ' ' + item.hidden_phone + ""); }, templateSelection: function(item){ if (item.id) { diff --git a/app/assets/javascripts/admins/users/index.js b/app/assets/javascripts/admins/users/index.js index c7b8e5e6a..8b2bb2f40 100644 --- a/app/assets/javascripts/admins/users/index.js +++ b/app/assets/javascripts/admins/users/index.js @@ -15,15 +15,19 @@ $(document).on('turbolinks:load', function(){ var $unlockAction = $lockAction.siblings('.unlock-action'); var userId = $lockAction.data('id'); - - $.ajax({ - url: '/admins/users/' + userId + '/lock', - method: 'POST', - dataType: 'json', - success: function() { - showSuccessNotify(); - $lockAction.hide(); - $unlockAction.show(); + customConfirm({ + content: '确认加锁吗?', + ok: function(){ + $.ajax({ + url: '/admins/users/' + userId + '/lock', + method: 'POST', + dataType: 'json', + success: function() { + showSuccessNotify(); + $lockAction.hide(); + $unlockAction.show(); + } + }); } }); }); @@ -34,17 +38,21 @@ $(document).on('turbolinks:load', function(){ var $lockAction = $unlockAction.siblings('.lock-action'); var userId = $unlockAction.data('id'); - - $.ajax({ - url: '/admins/users/' + userId + '/unlock', - method: 'POST', - dataType: 'json', - success: function() { - showSuccessNotify(); - $lockAction.show(); - $unlockAction.hide(); + customConfirm({ + content: '确认解锁吗?', + ok: function () { + $.ajax({ + url: '/admins/users/' + userId + '/unlock', + method: 'POST', + dataType: 'json', + success: function() { + showSuccessNotify(); + $lockAction.show(); + $unlockAction.hide(); + } + }); } - }); + }) }); // active user @@ -54,18 +62,22 @@ $(document).on('turbolinks:load', function(){ var $lockAction = $activeAction.siblings('.lock-action'); var userId = $activeAction.data('id'); - - $.ajax({ - url: '/admins/users/' + userId + '/unlock', - method: 'POST', - dataType: 'json', - success: function() { - showSuccessNotify(); - $activeAction.hide(); - $lockAction.show(); - $unlockAction.hide(); + customConfirm({ + content: '确认激活吗?', + ok: function () { + $.ajax({ + url: '/admins/users/' + userId + '/unlock', + method: 'POST', + dataType: 'json', + success: function() { + showSuccessNotify(); + $activeAction.hide(); + $lockAction.show(); + $unlockAction.hide(); + } + }); } - }); + }) }); // ***************** reward grade modal ***************** diff --git a/app/assets/javascripts/bootstrap-datetimepicker.js b/app/assets/javascripts/bootstrap-datetimepicker.js index 8838cbcd2..f66d69c13 100755 --- a/app/assets/javascripts/bootstrap-datetimepicker.js +++ b/app/assets/javascripts/bootstrap-datetimepicker.js @@ -1,2636 +1,1967 @@ -/*! version : 4.17.47 - ========================================================= - bootstrap-datetimejs - https://github.com/Eonasdan/bootstrap-datetimepicker - Copyright (c) 2015 Jonathan Peterson - ========================================================= - */ -/* - The MIT License (MIT) - - Copyright (c) 2015 Jonathan Peterson - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - */ -/*global define:false */ -/*global exports:false */ -/*global require:false */ -/*global jQuery:false */ -/*global moment:false */ -(function (factory) { - 'use strict'; - if (typeof define === 'function' && define.amd) { - // AMD is used - Register as an anonymous module. - define(['jquery', 'moment'], factory); - } else if (typeof exports === 'object') { - module.exports = factory(require('jquery'), require('moment')); - } else { - // Neither AMD nor CommonJS used. Use global variables. - if (typeof jQuery === 'undefined') { - throw 'bootstrap-datetimepicker requires jQuery to be loaded first'; +/* ========================================================= + * bootstrap-datetimepicker.js + * ========================================================= + * Copyright 2012 Stefan Petre + * + * Improvements by Andrew Rowls + * Improvements by Sébastien Malot + * Improvements by Yun Lai + * Improvements by Kenneth Henderick + * Improvements by CuGBabyBeaR + * Improvements by Christian Vaas + * + * Project URL : http://www.malot.fr/bootstrap-datetimepicker + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================================================= */ + +(function(factory){ + if (typeof define === 'function' && define.amd) + define(['jquery'], factory); + else if (typeof exports === 'object') + factory(require('jquery')); + else + factory(jQuery); + +}(function($, undefined){ + + // Add ECMA262-5 Array methods if not supported natively (IE8) + if (!('indexOf' in Array.prototype)) { + Array.prototype.indexOf = function (find, i) { + if (i === undefined) i = 0; + if (i < 0) i += this.length; + if (i < 0) i = 0; + for (var n = this.length; i < n; i++) { + if (i in this && this[i] === find) { + return i; } - if (typeof moment === 'undefined') { - throw 'bootstrap-datetimepicker requires Moment.js to be loaded first'; + } + return -1; + } + } + + // Add timezone abbreviation support for ie6+, Chrome, Firefox + function timeZoneAbbreviation() { + var abbreviation, date, formattedStr, i, len, matchedStrings, ref, str; + date = (new Date()).toString(); + formattedStr = ((ref = date.split('(')[1]) != null ? ref.slice(0, -1) : 0) || date.split(' '); + if (formattedStr instanceof Array) { + matchedStrings = []; + for (var i = 0, len = formattedStr.length; i < len; i++) { + str = formattedStr[i]; + if ((abbreviation = (ref = str.match(/\b[A-Z]+\b/)) !== null) ? ref[0] : 0) { + matchedStrings.push(abbreviation); } - factory(jQuery, moment); + } + formattedStr = matchedStrings.pop(); } -}(function ($, moment) { - 'use strict'; - if (!moment) { - throw new Error('bootstrap-datetimepicker requires Moment.js to be loaded first'); + return formattedStr; + } + + function UTCDate() { + return new Date(Date.UTC.apply(Date, arguments)); + } + + // Picker object + var Datetimepicker = function (element, options) { + var that = this; + + this.element = $(element); + + // add container for single page application + // when page switch the datetimepicker div will be removed also. + this.container = options.container || 'body'; + + this.language = options.language || this.element.data('date-language') || 'en'; + this.language = this.language in dates ? this.language : this.language.split('-')[0]; // fr-CA fallback to fr + this.language = this.language in dates ? this.language : 'en'; + this.isRTL = dates[this.language].rtl || false; + this.formatType = options.formatType || this.element.data('format-type') || 'standard'; + this.format = DPGlobal.parseFormat(options.format || this.element.data('date-format') || dates[this.language].format || DPGlobal.getDefaultFormat(this.formatType, 'input'), this.formatType); + this.isInline = false; + this.isVisible = false; + this.isInput = this.element.is('input'); + this.fontAwesome = options.fontAwesome || this.element.data('font-awesome') || false; + + this.bootcssVer = options.bootcssVer || (this.isInput ? (this.element.is('.form-control') ? 3 : 2) : ( this.bootcssVer = this.element.is('.input-group') ? 3 : 2 )); + + this.component = this.element.is('.date') ? ( this.bootcssVer === 3 ? this.element.find('.input-group-addon .glyphicon-th, .input-group-addon .glyphicon-time, .input-group-addon .glyphicon-remove, .input-group-addon .glyphicon-calendar, .input-group-addon .fa-calendar, .input-group-addon .fa-clock-o').parent() : this.element.find('.add-on .icon-th, .add-on .icon-time, .add-on .icon-calendar, .add-on .fa-calendar, .add-on .fa-clock-o').parent()) : false; + this.componentReset = this.element.is('.date') ? ( this.bootcssVer === 3 ? this.element.find('.input-group-addon .glyphicon-remove, .input-group-addon .fa-times').parent():this.element.find('.add-on .icon-remove, .add-on .fa-times').parent()) : false; + this.hasInput = this.component && this.element.find('input').length; + if (this.component && this.component.length === 0) { + this.component = false; } + this.linkField = options.linkField || this.element.data('link-field') || false; + this.linkFormat = DPGlobal.parseFormat(options.linkFormat || this.element.data('link-format') || DPGlobal.getDefaultFormat(this.formatType, 'link'), this.formatType); + this.minuteStep = options.minuteStep || this.element.data('minute-step') || 5; + this.pickerPosition = options.pickerPosition || this.element.data('picker-position') || 'bottom-right'; + this.showMeridian = options.showMeridian || this.element.data('show-meridian') || false; + this.initialDate = options.initialDate || new Date(); + this.zIndex = options.zIndex || this.element.data('z-index') || undefined; + this.title = typeof options.title === 'undefined' ? false : options.title; + this.timezone = options.timezone || timeZoneAbbreviation(); + + this.icons = { + leftArrow: this.fontAwesome ? 'fa-arrow-left' : (this.bootcssVer === 3 ? 'glyphicon-arrow-left' : 'icon-arrow-left'), + rightArrow: this.fontAwesome ? 'fa-arrow-right' : (this.bootcssVer === 3 ? 'glyphicon-arrow-right' : 'icon-arrow-right') + } + this.icontype = this.fontAwesome ? 'fa' : 'glyphicon'; - var dateTimePicker = function (element, options) { - var picker = {}, - date, - viewDate, - unset = true, - input, - component = false, - widget = false, - use24Hours, - minViewModeNumber = 0, - actualFormat, - parseFormats, - currentViewMode, - datePickerModes = [ - { - clsName: 'days', - navFnc: 'M', - navStep: 1 - }, - { - clsName: 'months', - navFnc: 'y', - navStep: 1 - }, - { - clsName: 'years', - navFnc: 'y', - navStep: 10 - }, - { - clsName: 'decades', - navFnc: 'y', - navStep: 100 - } - ], - viewModes = ['days', 'months', 'years', 'decades'], - verticalModes = ['top', 'bottom', 'auto'], - horizontalModes = ['left', 'right', 'auto'], - toolbarPlacements = ['default', 'top', 'bottom'], - keyMap = { - 'up': 38, - 38: 'up', - 'down': 40, - 40: 'down', - 'left': 37, - 37: 'left', - 'right': 39, - 39: 'right', - 'tab': 9, - 9: 'tab', - 'escape': 27, - 27: 'escape', - 'enter': 13, - 13: 'enter', - 'pageUp': 33, - 33: 'pageUp', - 'pageDown': 34, - 34: 'pageDown', - 'shift': 16, - 16: 'shift', - 'control': 17, - 17: 'control', - 'space': 32, - 32: 'space', - 't': 84, - 84: 't', - 'delete': 46, - 46: 'delete' - }, - keyState = {}, - - /******************************************************************************** - * - * Private functions - * - ********************************************************************************/ - - hasTimeZone = function () { - return moment.tz !== undefined && options.timeZone !== undefined && options.timeZone !== null && options.timeZone !== ''; - }, - - getMoment = function (d) { - var returnMoment; - - if (d === undefined || d === null) { - returnMoment = moment(); //TODO should this use format? and locale? - } else if (moment.isDate(d) || moment.isMoment(d)) { - // If the date that is passed in is already a Date() or moment() object, - // pass it directly to moment. - returnMoment = moment(d); - } else if (hasTimeZone()) { // There is a string to parse and a default time zone - // parse with the tz function which takes a default time zone if it is not in the format string - returnMoment = moment.tz(d, parseFormats, options.useStrict, options.timeZone); - } else { - returnMoment = moment(d, parseFormats, options.useStrict); - } - - if (hasTimeZone()) { - returnMoment.tz(options.timeZone); - } - - return returnMoment; - }, - - isEnabled = function (granularity) { - if (typeof granularity !== 'string' || granularity.length > 1) { - throw new TypeError('isEnabled expects a single character string parameter'); - } - switch (granularity) { - case 'y': - return actualFormat.indexOf('Y') !== -1; - case 'M': - return actualFormat.indexOf('M') !== -1; - case 'd': - return actualFormat.toLowerCase().indexOf('d') !== -1; - case 'h': - case 'H': - return actualFormat.toLowerCase().indexOf('h') !== -1; - case 'm': - return actualFormat.indexOf('m') !== -1; - case 's': - return actualFormat.indexOf('s') !== -1; - default: - return false; - } - }, - - hasTime = function () { - return (isEnabled('h') || isEnabled('m') || isEnabled('s')); - }, - - hasDate = function () { - return (isEnabled('y') || isEnabled('M') || isEnabled('d')); - }, - - getDatePickerTemplate = function () { - var headTemplate = $('') - .append($('') - .append($('').addClass('prev').attr('data-action', 'previous') - .append($('').addClass(options.icons.previous)) - ) - .append($('').addClass('picker-switch').attr('data-action', 'pickerSwitch').attr('colspan', (options.calendarWeeks ? '6' : '5'))) - .append($('').addClass('next').attr('data-action', 'next') - .append($('').addClass(options.icons.next)) - ) - ), - contTemplate = $('') - .append($('') - .append($('').attr('colspan', (options.calendarWeeks ? '8' : '7'))) - ); - - return [ - $('
').addClass('datepicker-days') - .append($('').addClass('table-condensed') - .append(headTemplate) - .append($('')) - ), - $('
').addClass('datepicker-months') - .append($('
').addClass('table-condensed') - .append(headTemplate.clone()) - .append(contTemplate.clone()) - ), - $('
').addClass('datepicker-years') - .append($('
').addClass('table-condensed') - .append(headTemplate.clone()) - .append(contTemplate.clone()) - ), - $('
').addClass('datepicker-decades') - .append($('
').addClass('table-condensed') - .append(headTemplate.clone()) - .append(contTemplate.clone()) - ) - ]; - }, - - getTimePickerMainTemplate = function () { - var topRow = $(''), - middleRow = $(''), - bottomRow = $(''); - - if (isEnabled('h')) { - topRow.append($('-
{item.visits_count}
+
{item.competition_status==="nearly_published"?"--":item.visits_count}
-
{item.member_count}
+
{item.competition_status==="nearly_published"?"--":item.member_count}
} > {item.name}{item.sub_title===null?"":{ + title={ + this.setcompetitonurl(item.competition_status==="ended"?null:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/newcompetitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/newcompetitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/newcompetitions/${item.identifier}/common_header`:null)} + >{item.name}{item.sub_title===null?"":{ item.sub_title }} } @@ -179,20 +192,20 @@ class CompetitionsIndex extends Component{ {item.description} - + ) } - /> + />} - {datas===undefined?'none':datas.task_count >6 ?
20 ?
{ + if(response.status===200){ + this.setState({ + bannerdata:response.data + }) + } + }).catch((error) => { + console.log(error) + }) } getbannerdata=()=>{ @@ -35,21 +49,29 @@ class CompetitionCommon extends Component{ } + getrightdata=(id,typeid)=>{ +debugger + } + render() { - let {data}=this.state; - console.log(data) + let {data,bannerdata}=this.state; + // console.log(bannerdata) return ( data===undefined?"":
在线竞赛 - 全国高校计算机大赛 + {data&&data.name}
-
banner - + + + + + {data&&data.name} @@ -76,20 +98,44 @@ class CompetitionCommon extends Component{
¥{data&&data.bonus}
-
{data&&data.visits_count}
+
{data.competition_status==="nearly_published"?"--":data&&data.visits_count}
-
{data&&data.member_count}
+
{data.competition_status==="nearly_published"?"--":data&&data.member_count}
+ {data.competition_status==="ended"?:} + {data.competition_status==="ended"? + : + 立即报名 + } - {data&&data.enroll_end_time===null?"":"报名截止时间:"+data&&data.enroll_end_time} + {data&&data.enroll_end_time===null?"":`报名截止时间:${data&&data.enroll_end_time}`} @@ -101,7 +147,11 @@ class CompetitionCommon extends Component{ {data&&data.competition_modules.map((item,key)=>{ return( - {item.name} + {item.has_url===false?this.getrightdata(item.id,item.module_type)}>{item.name}:this.getrightdata(item.id,item.module_type)} + >{item.name}} ) })} @@ -110,10 +160,8 @@ class CompetitionCommon extends Component{ - - - - + + diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionContents.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionContents.js new file mode 100644 index 000000000..5ba381b24 --- /dev/null +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionContents.js @@ -0,0 +1,38 @@ +import React, { Component } from 'react'; +import {Button,Layout} from 'antd'; +import axios from 'axios'; +import {markdownToHTML,getImageUrl} from 'educoder'; +import NoneData from "../../courses/shixunHomework/shixunHomework"; + +const { Header, Footer, Sider, Content } = Layout; +class CompetitionContents extends Component{ + constructor(props) { + super(props) + this.state={ + + } + } + + componentDidMount(){ + window.document.title = '竞赛'; + + } + + + + render() { + + return ( + +
+ + + +
+ + ) + } +} +export default CompetitionContents; \ No newline at end of file diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js new file mode 100644 index 000000000..9d7a10f18 --- /dev/null +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js @@ -0,0 +1,189 @@ +import React, { Component } from 'react'; +import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table} from 'antd'; +import axios from 'axios'; +import {markdownToHTML,getImageUrl} from 'educoder'; +import NoneData from "../../courses/shixunHomework/shixunHomework"; + +const { Header, Footer, Sider, Content } = Layout; +const { TabPane } = Tabs; +const { Meta } = Card; + +class CompetitionContents extends Component{ + constructor(props) { + super(props) + this.state={ + + } + } + + componentDidMount(){ + window.document.title = '竞赛'; + + } + + + + render() { + const operations = ; + const columns = [ + { + title: 'Name', + dataIndex: 'name', + key: 'name', + render: text => {text}, + }, + { + title: 'Age', + dataIndex: 'age', + key: 'age', + }, + { + title: 'Address', + dataIndex: 'address', + key: 'address', + }, + { + title: 'Tags', + key: 'tags', + dataIndex: 'tags', + render: tags => ( + + 123123 + + ), + }, + { + title: 'Action', + key: 'action', + render: (text, record) => ( + + Invite {record.name} + Delete + + ), + }, + { + title: 'Values', + key: 'values', + dataIndex: 'values', + render: tags => ( + + 123123 + + ), + }, + ]; + + const data = [ + { + key: '1', + name: 'John Brown', + age: 32, + address: 'New York No. 1 Lake Park', + tags: ['nice', 'developer'], + values:123 + }, + { + key: '2', + name: 'Jim Green', + age: 42, + address: 'London No. 1 Lake Park', + tags: ['loser'], + values:123 + }, + { + key: '3', + name: 'Joe Black', + age: 32, + address: 'Sidney No. 1 Lake Park', + tags: ['cool', 'teacher'], + values:123 + }, + ]; + + + return ( +
+ + + + + + + + + + + + + + + + +
+ 总排名 + + + + + + } + > + + + + + + } + > + + + + + + + } + > + + + + + + +
') - .append($('').attr({ href: '#', tabindex: '-1', 'title': options.tooltips.incrementHour }).addClass('btn').attr('data-action', 'incrementHours').append($('').addClass(options.icons.up)))); - middleRow.append($('') - .append($('').addClass('timepicker-hour').attr({ 'data-time-component': 'hours', 'title': options.tooltips.pickHour }).attr('data-action', 'showHours'))); - bottomRow.append($('') - .append($('').attr({ href: '#', tabindex: '-1', 'title': options.tooltips.decrementHour }).addClass('btn').attr('data-action', 'decrementHours').append($('').addClass(options.icons.down)))); - } - if (isEnabled('m')) { - if (isEnabled('h')) { - topRow.append($('').addClass('separator')); - middleRow.append($('').addClass('separator').html(':')); - bottomRow.append($('').addClass('separator')); - } - topRow.append($('') - .append($('').attr({ href: '#', tabindex: '-1', 'title': options.tooltips.incrementMinute }).addClass('btn').attr('data-action', 'incrementMinutes') - .append($('').addClass(options.icons.up)))); - middleRow.append($('') - .append($('').addClass('timepicker-minute').attr({ 'data-time-component': 'minutes', 'title': options.tooltips.pickMinute }).attr('data-action', 'showMinutes'))); - bottomRow.append($('') - .append($('').attr({ href: '#', tabindex: '-1', 'title': options.tooltips.decrementMinute }).addClass('btn').attr('data-action', 'decrementMinutes') - .append($('').addClass(options.icons.down)))); - } - if (isEnabled('s')) { - if (isEnabled('m')) { - topRow.append($('').addClass('separator')); - middleRow.append($('').addClass('separator').html(':')); - bottomRow.append($('').addClass('separator')); - } - topRow.append($('') - .append($('').attr({ href: '#', tabindex: '-1', 'title': options.tooltips.incrementSecond }).addClass('btn').attr('data-action', 'incrementSeconds') - .append($('').addClass(options.icons.up)))); - middleRow.append($('') - .append($('').addClass('timepicker-second').attr({ 'data-time-component': 'seconds', 'title': options.tooltips.pickSecond }).attr('data-action', 'showSeconds'))); - bottomRow.append($('') - .append($('').attr({ href: '#', tabindex: '-1', 'title': options.tooltips.decrementSecond }).addClass('btn').attr('data-action', 'decrementSeconds') - .append($('').addClass(options.icons.down)))); - } - - if (!use24Hours) { - topRow.append($('').addClass('separator')); - middleRow.append($('') - .append($('').addClass('separator')); - } - - return $('
').addClass('timepicker-picker') - .append($('').addClass('table-condensed') - .append([topRow, middleRow, bottomRow])); - }, - - getTimePickerTemplate = function () { - var hoursView = $('
').addClass('timepicker-hours') - .append($('
').addClass('table-condensed')), - minutesView = $('
').addClass('timepicker-minutes') - .append($('
').addClass('table-condensed')), - secondsView = $('
').addClass('timepicker-seconds') - .append($('
').addClass('table-condensed')), - ret = [getTimePickerMainTemplate()]; - - if (isEnabled('h')) { - ret.push(hoursView); - } - if (isEnabled('m')) { - ret.push(minutesView); - } - if (isEnabled('s')) { - ret.push(secondsView); - } + this._attachEvents(); - return ret; - }, + this.clickedOutside = function (e) { + // Clicked outside the datetimepicker, hide it + if ($(e.target).closest('.datetimepicker').length === 0) { + that.hide(); + } + } - getToolbar = function () { - var row = []; - if (options.showTodayButton) { - row.push($(''; + while (dowCnt < this.weekStart + 7) { + html += ''; + } + html += ''; + this.picker.find('.datetimepicker-days thead').append(html); + }, + + fillMonths: function () { + var html = ''; + var d = new Date(this.viewDate); + for (var i = 0; i < 12; i++) { + d.setUTCMonth(i); + var classes = this.onRenderMonth(d); + html += '' + dates[this.language].monthsShort[i] + ''; + } + this.picker.find('.datetimepicker-months td').html(html); + }, + + fill: function () { + if (!this.date || !this.viewDate) { + return; + } + var d = new Date(this.viewDate), + year = d.getUTCFullYear(), + month = d.getUTCMonth(), + dayMonth = d.getUTCDate(), + hours = d.getUTCHours(), + startYear = this.startDate.getUTCFullYear(), + startMonth = this.startDate.getUTCMonth(), + endYear = this.endDate.getUTCFullYear(), + endMonth = this.endDate.getUTCMonth() + 1, + currentDate = (new UTCDate(this.date.getUTCFullYear(), this.date.getUTCMonth(), this.date.getUTCDate())).valueOf(), + today = new Date(); + this.setTitle('.datetimepicker-days', dates[this.language].months[month] + ' ' + year) + if (this.formatViewType === 'time') { + var formatted = this.getFormattedDate(); + this.setTitle('.datetimepicker-hours', formatted); + this.setTitle('.datetimepicker-minutes', formatted); + } else { + this.setTitle('.datetimepicker-hours', dayMonth + ' ' + dates[this.language].months[month] + ' ' + year); + this.setTitle('.datetimepicker-minutes', dayMonth + ' ' + dates[this.language].months[month] + ' ' + year); + } + this.picker.find('tfoot th.today') + .text(dates[this.language].today || dates['en'].today) + .toggle(this.todayBtn !== false); + this.picker.find('tfoot th.clear') + .text(dates[this.language].clear || dates['en'].clear) + .toggle(this.clearBtn !== false); + this.updateNavArrows(); + this.fillMonths(); + var prevMonth = UTCDate(year, month - 1, 28, 0, 0, 0, 0), + day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth()); + prevMonth.setUTCDate(day); + prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7) % 7); + var nextMonth = new Date(prevMonth); + nextMonth.setUTCDate(nextMonth.getUTCDate() + 42); + nextMonth = nextMonth.valueOf(); + var html = []; + var classes; + while (prevMonth.valueOf() < nextMonth) { + if (prevMonth.getUTCDay() === this.weekStart) { + html.push(''); + } + classes = this.onRenderDay(prevMonth); + if (prevMonth.getUTCFullYear() < year || (prevMonth.getUTCFullYear() === year && prevMonth.getUTCMonth() < month)) { + classes.push('old'); + } else if (prevMonth.getUTCFullYear() > year || (prevMonth.getUTCFullYear() === year && prevMonth.getUTCMonth() > month)) { + classes.push('new'); + } + // Compare internal UTC date with local today, not UTC today + if (this.todayHighlight && + prevMonth.getUTCFullYear() === today.getFullYear() && + prevMonth.getUTCMonth() === today.getMonth() && + prevMonth.getUTCDate() === today.getDate()) { + classes.push('today'); + } + if (prevMonth.valueOf() === currentDate) { + classes.push('active'); + } + if ((prevMonth.valueOf() + 86400000) <= this.startDate || prevMonth.valueOf() > this.endDate || + $.inArray(prevMonth.getUTCDay(), this.daysOfWeekDisabled) !== -1 || + $.inArray(prevMonth.toDateString(), this.datesDisabled) !== -1) { + classes.push('disabled'); + } + html.push(''); + if (prevMonth.getUTCDay() === this.weekEnd) { + html.push(''); + } + prevMonth.setUTCDate(prevMonth.getUTCDate() + 1); + } + this.picker.find('.datetimepicker-days tbody').empty().append(html.join('')); + + html = []; + var txt = '', meridian = '', meridianOld = ''; + var hoursDisabled = this.hoursDisabled || []; + d = new Date(this.viewDate) + for (var i = 0; i < 24; i++) { + d.setUTCHours(i); + classes = this.onRenderHour(d); + if (hoursDisabled.indexOf(i) !== -1) { + classes.push('disabled'); + } + var actual = UTCDate(year, month, dayMonth, i); + // We want the previous hour for the startDate + if ((actual.valueOf() + 3600000) <= this.startDate || actual.valueOf() > this.endDate) { + classes.push('disabled'); + } else if (hours === i) { + classes.push('active'); + } + if (this.showMeridian && dates[this.language].meridiem.length === 2) { + meridian = (i < 12 ? dates[this.language].meridiem[0] : dates[this.language].meridiem[1]); + if (meridian !== meridianOld) { + if (meridianOld !== '') { + html.push(''); + } + html.push('
' + meridian.toUpperCase() + ''); + } + meridianOld = meridian; + txt = (i % 12 ? i % 12 : 12); + if (i < 12) { + classes.push('hour_am'); + } else { + classes.push('hour_pm'); + } + html.push('' + txt + ''); + if (i === 23) { + html.push('
'); + } + } else { + txt = i + ':00'; + html.push('' + txt + ''); + } + } + this.picker.find('.datetimepicker-hours td').html(html.join('')); + + html = []; + txt = ''; + meridian = ''; + meridianOld = ''; + var minutesDisabled = this.minutesDisabled || []; + d = new Date(this.viewDate); + for (var i = 0; i < 60; i += this.minuteStep) { + if (minutesDisabled.indexOf(i) !== -1) continue; + d.setUTCMinutes(i); + d.setUTCSeconds(0); + classes = this.onRenderMinute(d); + if (this.showMeridian && dates[this.language].meridiem.length === 2) { + meridian = (hours < 12 ? dates[this.language].meridiem[0] : dates[this.language].meridiem[1]); + if (meridian !== meridianOld) { + if (meridianOld !== '') { + html.push(''); + } + html.push('
' + meridian.toUpperCase() + ''); + } + meridianOld = meridian; + txt = (hours % 12 ? hours % 12 : 12); + html.push('' + txt + ':' + (i < 10 ? '0' + i : i) + ''); + if (i === 59) { + html.push('
'); + } + } else { + txt = i + ':00'; + html.push('' + hours + ':' + (i < 10 ? '0' + i : i) + ''); + } + } + this.picker.find('.datetimepicker-minutes td').html(html.join('')); + + var currentYear = this.date.getUTCFullYear(); + var months = this.setTitle('.datetimepicker-months', year) + .end() + .find('.month').removeClass('active'); + if (currentYear === year) { + // getUTCMonths() returns 0 based, and we need to select the next one + // To cater bootstrap 2 we don't need to select the next one + months.eq(this.date.getUTCMonth()).addClass('active'); + } + if (year < startYear || year > endYear) { + months.addClass('disabled'); + } + if (year === startYear) { + months.slice(0, startMonth).addClass('disabled'); + } + if (year === endYear) { + months.slice(endMonth).addClass('disabled'); + } + + html = ''; + year = parseInt(year / 10, 10) * 10; + var yearCont = this.setTitle('.datetimepicker-years', year + '-' + (year + 9)) + .end() + .find('td'); + year -= 1; + d = new Date(this.viewDate); + for (var i = -1; i < 11; i++) { + d.setUTCFullYear(year); + classes = this.onRenderYear(d); + if (i === -1 || i === 10) { + classes.push(old); + } + html += '' + year + ''; + year += 1; + } + yearCont.html(html); + this.place(); + }, + + updateNavArrows: function () { + var d = new Date(this.viewDate), + year = d.getUTCFullYear(), + month = d.getUTCMonth(), + day = d.getUTCDate(), + hour = d.getUTCHours(); + switch (this.viewMode) { + case 0: + if (year <= this.startDate.getUTCFullYear() + && month <= this.startDate.getUTCMonth() + && day <= this.startDate.getUTCDate() + && hour <= this.startDate.getUTCHours()) { + this.picker.find('.prev').css({visibility: 'hidden'}); + } else { + this.picker.find('.prev').css({visibility: 'visible'}); + } + if (year >= this.endDate.getUTCFullYear() + && month >= this.endDate.getUTCMonth() + && day >= this.endDate.getUTCDate() + && hour >= this.endDate.getUTCHours()) { + this.picker.find('.next').css({visibility: 'hidden'}); + } else { + this.picker.find('.next').css({visibility: 'visible'}); + } + break; + case 1: + if (year <= this.startDate.getUTCFullYear() + && month <= this.startDate.getUTCMonth() + && day <= this.startDate.getUTCDate()) { + this.picker.find('.prev').css({visibility: 'hidden'}); + } else { + this.picker.find('.prev').css({visibility: 'visible'}); + } + if (year >= this.endDate.getUTCFullYear() + && month >= this.endDate.getUTCMonth() + && day >= this.endDate.getUTCDate()) { + this.picker.find('.next').css({visibility: 'hidden'}); + } else { + this.picker.find('.next').css({visibility: 'visible'}); + } + break; + case 2: + if (year <= this.startDate.getUTCFullYear() + && month <= this.startDate.getUTCMonth()) { + this.picker.find('.prev').css({visibility: 'hidden'}); + } else { + this.picker.find('.prev').css({visibility: 'visible'}); + } + if (year >= this.endDate.getUTCFullYear() + && month >= this.endDate.getUTCMonth()) { + this.picker.find('.next').css({visibility: 'hidden'}); + } else { + this.picker.find('.next').css({visibility: 'visible'}); + } + break; + case 3: + case 4: + if (year <= this.startDate.getUTCFullYear()) { + this.picker.find('.prev').css({visibility: 'hidden'}); + } else { + this.picker.find('.prev').css({visibility: 'visible'}); + } + if (year >= this.endDate.getUTCFullYear()) { + this.picker.find('.next').css({visibility: 'hidden'}); + } else { + this.picker.find('.next').css({visibility: 'visible'}); + } + break; + } + }, + + mousewheel: function (e) { + + e.preventDefault(); + e.stopPropagation(); + + if (this.wheelPause) { + return; + } + + this.wheelPause = true; + + var originalEvent = e.originalEvent; + + var delta = originalEvent.wheelDelta; + + var mode = delta > 0 ? 1 : (delta === 0) ? 0 : -1; + + if (this.wheelViewModeNavigationInverseDirection) { + mode = -mode; + } + + this.showMode(mode); + + setTimeout($.proxy(function () { + + this.wheelPause = false + + }, this), this.wheelViewModeNavigationDelay); + + }, + + click: function (e) { + e.stopPropagation(); + e.preventDefault(); + var target = $(e.target).closest('span, td, th, legend'); + if (target.is('.' + this.icontype)) { + target = $(target).parent().closest('span, td, th, legend'); + } + if (target.length === 1) { + if (target.is('.disabled')) { + this.element.trigger({ + type: 'outOfRange', + date: this.viewDate, + startDate: this.startDate, + endDate: this.endDate + }); + return; + } + switch (target[0].nodeName.toLowerCase()) { + case 'th': + switch (target[0].className) { + case 'switch': + this.showMode(1); + break; + case 'prev': + case 'next': + var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1); + switch (this.viewMode) { + case 0: + this.viewDate = this.moveHour(this.viewDate, dir); + break; + case 1: + this.viewDate = this.moveDate(this.viewDate, dir); + break; + case 2: + this.viewDate = this.moveMonth(this.viewDate, dir); + break; + case 3: + case 4: + this.viewDate = this.moveYear(this.viewDate, dir); + break; + } + this.fill(); + this.element.trigger({ + type: target[0].className + ':' + this.convertViewModeText(this.viewMode), + date: this.viewDate, + startDate: this.startDate, + endDate: this.endDate + }); + break; + case 'clear': + this.reset(); + if (this.autoclose) { + this.hide(); + } + break; + case 'today': + var date = new Date(); + date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0); + + // Respect startDate and endDate. + if (date < this.startDate) date = this.startDate; + else if (date > this.endDate) date = this.endDate; + + this.viewMode = this.startViewMode; + this.showMode(0); + this._setDate(date); + this.fill(); + if (this.autoclose) { + this.hide(); + } + break; + } + break; + case 'span': + if (!target.is('.disabled')) { + var year = this.viewDate.getUTCFullYear(), + month = this.viewDate.getUTCMonth(), + day = this.viewDate.getUTCDate(), + hours = this.viewDate.getUTCHours(), + minutes = this.viewDate.getUTCMinutes(), + seconds = this.viewDate.getUTCSeconds(); + + if (target.is('.month')) { + this.viewDate.setUTCDate(1); + month = target.parent().find('span').index(target); + day = this.viewDate.getUTCDate(); + this.viewDate.setUTCMonth(month); + this.element.trigger({ + type: 'changeMonth', + date: this.viewDate + }); + if (this.viewSelect >= 3) { + this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0)); + } + } else if (target.is('.year')) { + this.viewDate.setUTCDate(1); + year = parseInt(target.text(), 10) || 0; + this.viewDate.setUTCFullYear(year); + this.element.trigger({ + type: 'changeYear', + date: this.viewDate + }); + if (this.viewSelect >= 4) { + this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0)); + } + } else if (target.is('.hour')) { + hours = parseInt(target.text(), 10) || 0; + if (target.hasClass('hour_am') || target.hasClass('hour_pm')) { + if (hours === 12 && target.hasClass('hour_am')) { + hours = 0; + } else if (hours !== 12 && target.hasClass('hour_pm')) { + hours += 12; + } + } + this.viewDate.setUTCHours(hours); + this.element.trigger({ + type: 'changeHour', + date: this.viewDate + }); + if (this.viewSelect >= 1) { + this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0)); + } + } else if (target.is('.minute')) { + minutes = parseInt(target.text().substr(target.text().indexOf(':') + 1), 10) || 0; + this.viewDate.setUTCMinutes(minutes); + this.element.trigger({ + type: 'changeMinute', + date: this.viewDate + }); + if (this.viewSelect >= 0) { + this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0)); + } + } + if (this.viewMode !== 0) { + var oldViewMode = this.viewMode; + this.showMode(-1); + this.fill(); + if (oldViewMode === this.viewMode && this.autoclose) { + this.hide(); + } + } else { + this.fill(); + if (this.autoclose) { + this.hide(); + } + } + } + break; + case 'td': + if (target.is('.day') && !target.is('.disabled')) { + var day = parseInt(target.text(), 10) || 1; + var year = this.viewDate.getUTCFullYear(), + month = this.viewDate.getUTCMonth(), + hours = this.viewDate.getUTCHours(), + minutes = this.viewDate.getUTCMinutes(), + seconds = this.viewDate.getUTCSeconds(); + if (target.is('.old')) { + if (month === 0) { + month = 11; + year -= 1; + } else { + month -= 1; + } + } else if (target.is('.new')) { + if (month === 11) { + month = 0; + year += 1; + } else { + month += 1; + } + } + this.viewDate.setUTCFullYear(year); + this.viewDate.setUTCMonth(month, day); + this.element.trigger({ + type: 'changeDay', + date: this.viewDate + }); + if (this.viewSelect >= 2) { + this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0)); + } + } + var oldViewMode = this.viewMode; + this.showMode(-1); + this.fill(); + if (oldViewMode === this.viewMode && this.autoclose) { + this.hide(); + } + break; + } + } + }, + + _setDate: function (date, which) { + if (!which || which === 'date') + this.date = date; + if (!which || which === 'view') + this.viewDate = date; + this.fill(); + this.setValue(); + var element; + if (this.isInput) { + element = this.element; + } else if (this.component) { + element = this.element.find('input'); + } + if (element) { + element.change(); + } + this.element.trigger({ + type: 'changeDate', + date: this.getDate() + }); + if(date === null) + this.date = this.viewDate; + }, + + moveMinute: function (date, dir) { + if (!dir) return date; + var new_date = new Date(date.valueOf()); + //dir = dir > 0 ? 1 : -1; + new_date.setUTCMinutes(new_date.getUTCMinutes() + (dir * this.minuteStep)); + return new_date; + }, + + moveHour: function (date, dir) { + if (!dir) return date; + var new_date = new Date(date.valueOf()); + //dir = dir > 0 ? 1 : -1; + new_date.setUTCHours(new_date.getUTCHours() + dir); + return new_date; + }, + + moveDate: function (date, dir) { + if (!dir) return date; + var new_date = new Date(date.valueOf()); + //dir = dir > 0 ? 1 : -1; + new_date.setUTCDate(new_date.getUTCDate() + dir); + return new_date; + }, + + moveMonth: function (date, dir) { + if (!dir) return date; + var new_date = new Date(date.valueOf()), + day = new_date.getUTCDate(), + month = new_date.getUTCMonth(), + mag = Math.abs(dir), + new_month, test; + dir = dir > 0 ? 1 : -1; + if (mag === 1) { + test = dir === -1 + // If going back one month, make sure month is not current month + // (eg, Mar 31 -> Feb 31 === Feb 28, not Mar 02) + ? function () { + return new_date.getUTCMonth() === month; + } + // If going forward one month, make sure month is as expected + // (eg, Jan 31 -> Feb 31 === Feb 28, not Mar 02) + : function () { + return new_date.getUTCMonth() !== new_month; + }; + new_month = month + dir; + new_date.setUTCMonth(new_month); + // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11 + if (new_month < 0 || new_month > 11) + new_month = (new_month + 12) % 12; + } else { + // For magnitudes >1, move one month at a time... + for (var i = 0; i < mag; i++) + // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)... + new_date = this.moveMonth(new_date, dir); + // ...then reset the day, keeping it in the new month + new_month = new_date.getUTCMonth(); + new_date.setUTCDate(day); + test = function () { + return new_month !== new_date.getUTCMonth(); + }; + } + // Common date-resetting loop -- if date is beyond end of month, make it + // end of month + while (test()) { + new_date.setUTCDate(--day); + new_date.setUTCMonth(new_month); + } + return new_date; + }, + + moveYear: function (date, dir) { + return this.moveMonth(date, dir * 12); + }, + + dateWithinRange: function (date) { + return date >= this.startDate && date <= this.endDate; + }, + + keydown: function (e) { + if (this.picker.is(':not(:visible)')) { + if (e.keyCode === 27) // allow escape to hide and re-show picker + this.show(); + return; + } + var dateChanged = false, + dir, newDate, newViewDate; + switch (e.keyCode) { + case 27: // escape + this.hide(); + e.preventDefault(); + break; + case 37: // left + case 39: // right + if (!this.keyboardNavigation) break; + dir = e.keyCode === 37 ? -1 : 1; + var viewMode = this.viewMode; + if (e.ctrlKey) { + viewMode += 2; + } else if (e.shiftKey) { + viewMode += 1; + } + if (viewMode === 4) { + newDate = this.moveYear(this.date, dir); + newViewDate = this.moveYear(this.viewDate, dir); + } else if (viewMode === 3) { + newDate = this.moveMonth(this.date, dir); + newViewDate = this.moveMonth(this.viewDate, dir); + } else if (viewMode === 2) { + newDate = this.moveDate(this.date, dir); + newViewDate = this.moveDate(this.viewDate, dir); + } else if (viewMode === 1) { + newDate = this.moveHour(this.date, dir); + newViewDate = this.moveHour(this.viewDate, dir); + } else if (viewMode === 0) { + newDate = this.moveMinute(this.date, dir); + newViewDate = this.moveMinute(this.viewDate, dir); + } + if (this.dateWithinRange(newDate)) { + this.date = newDate; + this.viewDate = newViewDate; + this.setValue(); + this.update(); + e.preventDefault(); + dateChanged = true; + } + break; + case 38: // up + case 40: // down + if (!this.keyboardNavigation) break; + dir = e.keyCode === 38 ? -1 : 1; + viewMode = this.viewMode; + if (e.ctrlKey) { + viewMode += 2; + } else if (e.shiftKey) { + viewMode += 1; + } + if (viewMode === 4) { + newDate = this.moveYear(this.date, dir); + newViewDate = this.moveYear(this.viewDate, dir); + } else if (viewMode === 3) { + newDate = this.moveMonth(this.date, dir); + newViewDate = this.moveMonth(this.viewDate, dir); + } else if (viewMode === 2) { + newDate = this.moveDate(this.date, dir * 7); + newViewDate = this.moveDate(this.viewDate, dir * 7); + } else if (viewMode === 1) { + if (this.showMeridian) { + newDate = this.moveHour(this.date, dir * 6); + newViewDate = this.moveHour(this.viewDate, dir * 6); + } else { + newDate = this.moveHour(this.date, dir * 4); + newViewDate = this.moveHour(this.viewDate, dir * 4); + } + } else if (viewMode === 0) { + newDate = this.moveMinute(this.date, dir * 4); + newViewDate = this.moveMinute(this.viewDate, dir * 4); + } + if (this.dateWithinRange(newDate)) { + this.date = newDate; + this.viewDate = newViewDate; + this.setValue(); + this.update(); + e.preventDefault(); + dateChanged = true; + } + break; + case 13: // enter + if (this.viewMode !== 0) { + var oldViewMode = this.viewMode; + this.showMode(-1); + this.fill(); + if (oldViewMode === this.viewMode && this.autoclose) { + this.hide(); + } + } else { + this.fill(); + if (this.autoclose) { + this.hide(); + } + } + e.preventDefault(); + break; + case 9: // tab + this.hide(); + break; + } + if (dateChanged) { + var element; + if (this.isInput) { + element = this.element; + } else if (this.component) { + element = this.element.find('input'); + } + if (element) { + element.change(); + } + this.element.trigger({ + type: 'changeDate', + date: this.getDate() + }); + } + }, + + showMode: function (dir) { + if (dir) { + var newViewMode = Math.max(0, Math.min(DPGlobal.modes.length - 1, this.viewMode + dir)); + if (newViewMode >= this.minView && newViewMode <= this.maxView) { + this.element.trigger({ + type: 'changeMode', + date: this.viewDate, + oldViewMode: this.viewMode, + newViewMode: newViewMode + }); + + this.viewMode = newViewMode; + } + } + /* + vitalets: fixing bug of very special conditions: + jquery 1.7.1 + webkit + show inline datetimepicker in bootstrap popover. + Method show() does not set display css correctly and datetimepicker is not shown. + Changed to .css('display', 'block') solve the problem. + See https://github.com/vitalets/x-editable/issues/37 + + In jquery 1.7.2+ everything works fine. + */ + //this.picker.find('>div').hide().filter('.datetimepicker-'+DPGlobal.modes[this.viewMode].clsName).show(); + this.picker.find('>div').hide().filter('.datetimepicker-' + DPGlobal.modes[this.viewMode].clsName).css('display', 'block'); + this.updateNavArrows(); + }, + + reset: function () { + this._setDate(null, 'date'); + }, + + convertViewModeText: function (viewMode) { + switch (viewMode) { + case 4: + return 'decade'; + case 3: + return 'year'; + case 2: + return 'month'; + case 1: + return 'day'; + case 0: + return 'hour'; + } + } + }; + + var old = $.fn.datetimepicker; + $.fn.datetimepicker = function (option) { + var args = Array.apply(null, arguments); + args.shift(); + var internal_return; + this.each(function () { + var $this = $(this), + data = $this.data('datetimepicker'), + options = typeof option === 'object' && option; + if (!data) { + $this.data('datetimepicker', (data = new Datetimepicker(this, $.extend({}, $.fn.datetimepicker.defaults, options)))); + } + if (typeof option === 'string' && typeof data[option] === 'function') { + internal_return = data[option].apply(data, args); + if (internal_return !== undefined) { + return false; + } + } + }); + if (internal_return !== undefined) + return internal_return; + else + return this; + }; + + $.fn.datetimepicker.defaults = { + }; + $.fn.datetimepicker.Constructor = Datetimepicker; + var dates = $.fn.datetimepicker.dates = { + en: { + days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'], + daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], + daysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'], + months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + meridiem: ['am', 'pm'], + suffix: ['st', 'nd', 'rd', 'th'], + today: 'Today', + clear: 'Clear' + } + }; + + var DPGlobal = { + modes: [ + { + clsName: 'minutes', + navFnc: 'Hours', + navStep: 1 + }, + { + clsName: 'hours', + navFnc: 'Date', + navStep: 1 + }, + { + clsName: 'days', + navFnc: 'Month', + navStep: 1 + }, + { + clsName: 'months', + navFnc: 'FullYear', + navStep: 1 + }, + { + clsName: 'years', + navFnc: 'FullYear', + navStep: 10 + } + ], + isLeapYear: function (year) { + return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)) + }, + getDaysInMonth: function (year, month) { + return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month] + }, + getDefaultFormat: function (type, field) { + if (type === 'standard') { + if (field === 'input') + return 'yyyy-mm-dd hh:ii'; + else + return 'yyyy-mm-dd hh:ii:ss'; + } else if (type === 'php') { + if (field === 'input') + return 'Y-m-d H:i'; + else + return 'Y-m-d H:i:s'; + } else { + throw new Error('Invalid format type.'); + } + }, + validParts: function (type) { + if (type === 'standard') { + return /t|hh?|HH?|p|P|z|Z|ii?|ss?|dd?|DD?|mm?|MM?|yy(?:yy)?/g; + } else if (type === 'php') { + return /[dDjlNwzFmMnStyYaABgGhHis]/g; + } else { + throw new Error('Invalid format type.'); + } + }, + nonpunctuation: /[^ -\/:-@\[-`{-~\t\n\rTZ]+/g, + parseFormat: function (format, type) { + // IE treats \0 as a string end in inputs (truncating the value), + // so it's a bad format delimiter, anyway + var separators = format.replace(this.validParts(type), '\0').split('\0'), + parts = format.match(this.validParts(type)); + if (!separators || !separators.length || !parts || parts.length === 0) { + throw new Error('Invalid date format.'); + } + return {separators: separators, parts: parts}; + }, + parseDate: function (date, format, language, type, timezone) { + if (date instanceof Date) { + var dateUTC = new Date(date.valueOf() - date.getTimezoneOffset() * 60000); + dateUTC.setMilliseconds(0); + return dateUTC; + } + if (/^\d{4}\-\d{1,2}\-\d{1,2}$/.test(date)) { + format = this.parseFormat('yyyy-mm-dd', type); + } + if (/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}$/.test(date)) { + format = this.parseFormat('yyyy-mm-dd hh:ii', type); + } + if (/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}\:\d{1,2}[Z]{0,1}$/.test(date)) { + format = this.parseFormat('yyyy-mm-dd hh:ii:ss', type); + } + if (/^[-+]\d+[dmwy]([\s,]+[-+]\d+[dmwy])*$/.test(date)) { + var part_re = /([-+]\d+)([dmwy])/, + parts = date.match(/([-+]\d+)([dmwy])/g), + part, dir; + date = new Date(); + for (var i = 0; i < parts.length; i++) { + part = part_re.exec(parts[i]); + dir = parseInt(part[1]); + switch (part[2]) { + case 'd': + date.setUTCDate(date.getUTCDate() + dir); + break; + case 'm': + date = Datetimepicker.prototype.moveMonth.call(Datetimepicker.prototype, date, dir); + break; + case 'w': + date.setUTCDate(date.getUTCDate() + dir * 7); + break; + case 'y': + date = Datetimepicker.prototype.moveYear.call(Datetimepicker.prototype, date, dir); + break; + } + } + return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), 0); + } + var parts = date && date.toString().match(this.nonpunctuation) || [], + date = new Date(0, 0, 0, 0, 0, 0, 0), + parsed = {}, + setters_order = ['hh', 'h', 'ii', 'i', 'ss', 's', 'yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'D', 'DD', 'd', 'dd', 'H', 'HH', 'p', 'P', 'z', 'Z'], + setters_map = { + hh: function (d, v) { + return d.setUTCHours(v); + }, + h: function (d, v) { + return d.setUTCHours(v); + }, + HH: function (d, v) { + return d.setUTCHours(v === 12 ? 0 : v); + }, + H: function (d, v) { + return d.setUTCHours(v === 12 ? 0 : v); + }, + ii: function (d, v) { + return d.setUTCMinutes(v); + }, + i: function (d, v) { + return d.setUTCMinutes(v); + }, + ss: function (d, v) { + return d.setUTCSeconds(v); + }, + s: function (d, v) { + return d.setUTCSeconds(v); + }, + yyyy: function (d, v) { + return d.setUTCFullYear(v); + }, + yy: function (d, v) { + return d.setUTCFullYear(2000 + v); + }, + m: function (d, v) { + v -= 1; + while (v < 0) v += 12; + v %= 12; + d.setUTCMonth(v); + while (d.getUTCMonth() !== v) + if (isNaN(d.getUTCMonth())) + return d; + else + d.setUTCDate(d.getUTCDate() - 1); + return d; + }, + d: function (d, v) { + return d.setUTCDate(v); + }, + p: function (d, v) { + return d.setUTCHours(v === 1 ? d.getUTCHours() + 12 : d.getUTCHours()); + }, + z: function () { + return timezone + } + }, + val, filtered, part; + setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m']; + setters_map['dd'] = setters_map['d']; + setters_map['P'] = setters_map['p']; + setters_map['Z'] = setters_map['z']; + date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()); + if (parts.length === format.parts.length) { + for (var i = 0, cnt = format.parts.length; i < cnt; i++) { + val = parseInt(parts[i], 10); + part = format.parts[i]; + if (isNaN(val)) { + switch (part) { + case 'MM': + filtered = $(dates[language].months).filter(function () { + var m = this.slice(0, parts[i].length), + p = parts[i].slice(0, m.length); + return m === p; + }); + val = $.inArray(filtered[0], dates[language].months) + 1; + break; + case 'M': + filtered = $(dates[language].monthsShort).filter(function () { + var m = this.slice(0, parts[i].length), + p = parts[i].slice(0, m.length); + return m.toLowerCase() === p.toLowerCase(); + }); + val = $.inArray(filtered[0], dates[language].monthsShort) + 1; + break; + case 'p': + case 'P': + val = $.inArray(parts[i].toLowerCase(), dates[language].meridiem); + break; + case 'z': + case 'Z': + timezone; + break; + + } + } + parsed[part] = val; + } + for (var i = 0, s; i < setters_order.length; i++) { + s = setters_order[i]; + if (s in parsed && !isNaN(parsed[s])) + setters_map[s](date, parsed[s]) + } + } + return date; + }, + formatDate: function (date, format, language, type, timezone) { + if (date === null) { + return ''; + } + var val; + if (type === 'standard') { + val = { + t: date.getTime(), + // year + yy: date.getUTCFullYear().toString().substring(2), + yyyy: date.getUTCFullYear(), + // month + m: date.getUTCMonth() + 1, + M: dates[language].monthsShort[date.getUTCMonth()], + MM: dates[language].months[date.getUTCMonth()], + // day + d: date.getUTCDate(), + D: dates[language].daysShort[date.getUTCDay()], + DD: dates[language].days[date.getUTCDay()], + p: (dates[language].meridiem.length === 2 ? dates[language].meridiem[date.getUTCHours() < 12 ? 0 : 1] : ''), + // hour + h: date.getUTCHours(), + // minute + i: date.getUTCMinutes(), + // second + s: date.getUTCSeconds(), + // timezone + z: timezone + }; + + if (dates[language].meridiem.length === 2) { + val.H = (val.h % 12 === 0 ? 12 : val.h % 12); + } + else { + val.H = val.h; + } + val.HH = (val.H < 10 ? '0' : '') + val.H; + val.P = val.p.toUpperCase(); + val.Z = val.z; + val.hh = (val.h < 10 ? '0' : '') + val.h; + val.ii = (val.i < 10 ? '0' : '') + val.i; + val.ss = (val.s < 10 ? '0' : '') + val.s; + val.dd = (val.d < 10 ? '0' : '') + val.d; + val.mm = (val.m < 10 ? '0' : '') + val.m; + } else if (type === 'php') { + // php format + val = { + // year + y: date.getUTCFullYear().toString().substring(2), + Y: date.getUTCFullYear(), + // month + F: dates[language].months[date.getUTCMonth()], + M: dates[language].monthsShort[date.getUTCMonth()], + n: date.getUTCMonth() + 1, + t: DPGlobal.getDaysInMonth(date.getUTCFullYear(), date.getUTCMonth()), + // day + j: date.getUTCDate(), + l: dates[language].days[date.getUTCDay()], + D: dates[language].daysShort[date.getUTCDay()], + w: date.getUTCDay(), // 0 -> 6 + N: (date.getUTCDay() === 0 ? 7 : date.getUTCDay()), // 1 -> 7 + S: (date.getUTCDate() % 10 <= dates[language].suffix.length ? dates[language].suffix[date.getUTCDate() % 10 - 1] : ''), + // hour + a: (dates[language].meridiem.length === 2 ? dates[language].meridiem[date.getUTCHours() < 12 ? 0 : 1] : ''), + g: (date.getUTCHours() % 12 === 0 ? 12 : date.getUTCHours() % 12), + G: date.getUTCHours(), + // minute + i: date.getUTCMinutes(), + // second + s: date.getUTCSeconds() + }; + val.m = (val.n < 10 ? '0' : '') + val.n; + val.d = (val.j < 10 ? '0' : '') + val.j; + val.A = val.a.toString().toUpperCase(); + val.h = (val.g < 10 ? '0' : '') + val.g; + val.H = (val.G < 10 ? '0' : '') + val.G; + val.i = (val.i < 10 ? '0' : '') + val.i; + val.s = (val.s < 10 ? '0' : '') + val.s; + } else { + throw new Error('Invalid format type.'); + } + var date = [], + seps = $.extend([], format.separators); + for (var i = 0, cnt = format.parts.length; i < cnt; i++) { + if (seps.length) { + date.push(seps.shift()); + } + date.push(val[format.parts[i]]); + } + if (seps.length) { + date.push(seps.shift()); + } + return date.join(''); + }, + convertViewMode: function (viewMode) { + switch (viewMode) { + case 4: + case 'decade': + viewMode = 4; + break; + case 3: + case 'year': + viewMode = 3; + break; + case 2: + case 'month': + viewMode = 2; + break; + case 1: + case 'day': + viewMode = 1; + break; + case 0: + case 'hour': + viewMode = 0; + break; + } + + return viewMode; + }, + headTemplate: '' + + '' + + '' + + '' + + '' + + '' + + '', + headTemplateV3: '' + + '' + + '' + + '' + + '' + + '' + + '', + contTemplate: '', + footTemplate: '' + + '' + + '' + + '' + }; + DPGlobal.template = '
' + + '
' + + '
').append($('').attr({ 'data-action': 'today', 'title': options.tooltips.today }).append($('').addClass(options.icons.today)))); - } - if (!options.sideBySide && hasDate() && hasTime()) { - row.push($('').append($('').attr({ 'data-action': 'togglePicker', 'title': options.tooltips.selectTime }).append($('').addClass(options.icons.time)))); - } - if (options.showClear) { - row.push($('').append($('').attr({ 'data-action': 'clear', 'title': options.tooltips.clear }).append($('').addClass(options.icons.clear)))); - } - if (options.showClose) { - row.push($('').append($('').attr({ 'data-action': 'close', 'title': options.tooltips.close }).append($('').addClass(options.icons.close)))); - } - return $('').addClass('table-condensed').append($('').append($('').append(row))); - }, - - getTemplate = function () { - var template = $('
').addClass('bootstrap-datetimepicker-widget dropdown-menu'), - dateView = $('
').addClass('datepicker').append(getDatePickerTemplate()), - timeView = $('
').addClass('timepicker').append(getTimePickerTemplate()), - content = $('
    ').addClass('list-unstyled'), - toolbar = $('
  • ').addClass('picker-switch' + (options.collapse ? ' accordion-toggle' : '')).append(getToolbar()); - - if (options.inline) { - template.removeClass('dropdown-menu'); - } + this.formatViewType = 'datetime'; + if ('formatViewType' in options) { + this.formatViewType = options.formatViewType; + } else if ('formatViewType' in this.element.data()) { + this.formatViewType = this.element.data('formatViewType'); + } - if (use24Hours) { - template.addClass('usetwentyfour'); - } + this.minView = 0; + if ('minView' in options) { + this.minView = options.minView; + } else if ('minView' in this.element.data()) { + this.minView = this.element.data('min-view'); + } + this.minView = DPGlobal.convertViewMode(this.minView); - if (isEnabled('s') && !use24Hours) { - template.addClass('wider'); - } + this.maxView = DPGlobal.modes.length - 1; + if ('maxView' in options) { + this.maxView = options.maxView; + } else if ('maxView' in this.element.data()) { + this.maxView = this.element.data('max-view'); + } + this.maxView = DPGlobal.convertViewMode(this.maxView); - if (options.sideBySide && hasDate() && hasTime()) { - template.addClass('timepicker-sbs'); - if (options.toolbarPlacement === 'top') { - template.append(toolbar); - } - template.append( - $('
    ').addClass('row') - .append(dateView.addClass('col-md-6')) - .append(timeView.addClass('col-md-6')) - ); - if (options.toolbarPlacement === 'bottom') { - template.append(toolbar); - } - return template; - } + this.wheelViewModeNavigation = false; + if ('wheelViewModeNavigation' in options) { + this.wheelViewModeNavigation = options.wheelViewModeNavigation; + } else if ('wheelViewModeNavigation' in this.element.data()) { + this.wheelViewModeNavigation = this.element.data('view-mode-wheel-navigation'); + } - if (options.toolbarPlacement === 'top') { - content.append(toolbar); - } - if (hasDate()) { - content.append($('
  • ').addClass((options.collapse && hasTime() ? 'collapse in' : '')).append(dateView)); - } - if (options.toolbarPlacement === 'default') { - content.append(toolbar); - } - if (hasTime()) { - content.append($('
  • ').addClass((options.collapse && hasDate() ? 'collapse' : '')).append(timeView)); - } - if (options.toolbarPlacement === 'bottom') { - content.append(toolbar); - } - return template.append(content); - }, + this.wheelViewModeNavigationInverseDirection = false; - dataToOptions = function () { - var eData, - dataOptions = {}; + if ('wheelViewModeNavigationInverseDirection' in options) { + this.wheelViewModeNavigationInverseDirection = options.wheelViewModeNavigationInverseDirection; + } else if ('wheelViewModeNavigationInverseDirection' in this.element.data()) { + this.wheelViewModeNavigationInverseDirection = this.element.data('view-mode-wheel-navigation-inverse-dir'); + } - if (element.is('input') || options.inline) { - eData = element.data(); - } else { - eData = element.find('input').data(); - } + this.wheelViewModeNavigationDelay = 100; + if ('wheelViewModeNavigationDelay' in options) { + this.wheelViewModeNavigationDelay = options.wheelViewModeNavigationDelay; + } else if ('wheelViewModeNavigationDelay' in this.element.data()) { + this.wheelViewModeNavigationDelay = this.element.data('view-mode-wheel-navigation-delay'); + } - if (eData.dateOptions && eData.dateOptions instanceof Object) { - dataOptions = $.extend(true, dataOptions, eData.dateOptions); - } + this.startViewMode = 2; + if ('startView' in options) { + this.startViewMode = options.startView; + } else if ('startView' in this.element.data()) { + this.startViewMode = this.element.data('start-view'); + } + this.startViewMode = DPGlobal.convertViewMode(this.startViewMode); + this.viewMode = this.startViewMode; + + this.viewSelect = this.minView; + if ('viewSelect' in options) { + this.viewSelect = options.viewSelect; + } else if ('viewSelect' in this.element.data()) { + this.viewSelect = this.element.data('view-select'); + } + this.viewSelect = DPGlobal.convertViewMode(this.viewSelect); - $.each(options, function (key) { - var attributeName = 'date' + key.charAt(0).toUpperCase() + key.slice(1); - if (eData[attributeName] !== undefined) { - dataOptions[key] = eData[attributeName]; - } - }); - return dataOptions; - }, - - place = function () { - var position = (component || element).position(), - offset = (component || element).offset(), - vertical = options.widgetPositioning.vertical, - horizontal = options.widgetPositioning.horizontal, - parent; - - if (options.widgetParent) { - parent = options.widgetParent.append(widget); - } else if (element.is('input')) { - parent = element.after(widget).parent(); - } else if (options.inline) { - parent = element.append(widget); - return; - } else { - parent = element; - element.children().first().after(widget); - } + this.forceParse = true; + if ('forceParse' in options) { + this.forceParse = options.forceParse; + } else if ('dateForceParse' in this.element.data()) { + this.forceParse = this.element.data('date-force-parse'); + } + var template = this.bootcssVer === 3 ? DPGlobal.templateV3 : DPGlobal.template; + while (template.indexOf('{iconType}') !== -1) { + template = template.replace('{iconType}', this.icontype); + } + while (template.indexOf('{leftArrow}') !== -1) { + template = template.replace('{leftArrow}', this.icons.leftArrow); + } + while (template.indexOf('{rightArrow}') !== -1) { + template = template.replace('{rightArrow}', this.icons.rightArrow); + } + this.picker = $(template) + .appendTo(this.isInline ? this.element : this.container) // 'body') + .on({ + click: $.proxy(this.click, this), + mousedown: $.proxy(this.mousedown, this) + }); + + if (this.wheelViewModeNavigation) { + if ($.fn.mousewheel) { + this.picker.on({mousewheel: $.proxy(this.mousewheel, this)}); + } else { + console.log('Mouse Wheel event is not supported. Please include the jQuery Mouse Wheel plugin before enabling this option'); + } + } - // Top and bottom logic - if (vertical === 'auto') { - if (offset.top + widget.height() * 1.5 >= $(window).height() + $(window).scrollTop() && - widget.height() + element.outerHeight() < offset.top) { - vertical = 'top'; - } else { - vertical = 'bottom'; - } - } + if (this.isInline) { + this.picker.addClass('datetimepicker-inline'); + } else { + this.picker.addClass('datetimepicker-dropdown-' + this.pickerPosition + ' dropdown-menu'); + } + if (this.isRTL) { + this.picker.addClass('datetimepicker-rtl'); + var selector = this.bootcssVer === 3 ? '.prev span, .next span' : '.prev i, .next i'; + this.picker.find(selector).toggleClass(this.icons.leftArrow + ' ' + this.icons.rightArrow); + } - // Left and right logic - if (horizontal === 'auto') { - if (parent.width() < offset.left + widget.outerWidth() / 2 && - offset.left + widget.outerWidth() > $(window).width()) { - horizontal = 'right'; - } else { - horizontal = 'left'; - } - } + $(document).on('mousedown touchend', this.clickedOutside); - if (vertical === 'top') { - widget.addClass('top').removeClass('bottom'); - } else { - widget.addClass('bottom').removeClass('top'); - } + this.autoclose = false; + if ('autoclose' in options) { + this.autoclose = options.autoclose; + } else if ('dateAutoclose' in this.element.data()) { + this.autoclose = this.element.data('date-autoclose'); + } - if (horizontal === 'right') { - widget.addClass('pull-right'); - } else { - widget.removeClass('pull-right'); - } + this.keyboardNavigation = true; + if ('keyboardNavigation' in options) { + this.keyboardNavigation = options.keyboardNavigation; + } else if ('dateKeyboardNavigation' in this.element.data()) { + this.keyboardNavigation = this.element.data('date-keyboard-navigation'); + } - // find the first parent element that has a non-static css positioning - if (parent.css('position') === 'static') { - parent = parent.parents().filter(function () { - return $(this).css('position') !== 'static'; - }).first(); - } + this.todayBtn = (options.todayBtn || this.element.data('date-today-btn') || false); + this.clearBtn = (options.clearBtn || this.element.data('date-clear-btn') || false); + this.todayHighlight = (options.todayHighlight || this.element.data('date-today-highlight') || false); + + this.weekStart = 0; + if (typeof options.weekStart !== 'undefined') { + this.weekStart = options.weekStart; + } else if (typeof this.element.data('date-weekstart') !== 'undefined') { + this.weekStart = this.element.data('date-weekstart'); + } else if (typeof dates[this.language].weekStart !== 'undefined') { + this.weekStart = dates[this.language].weekStart; + } + this.weekStart = this.weekStart % 7; + this.weekEnd = ((this.weekStart + 6) % 7); + this.onRenderDay = function (date) { + var render = (options.onRenderDay || function () { return []; })(date); + if (typeof render === 'string') { + render = [render]; + } + var res = ['day']; + return res.concat((render ? render : [])); + }; + this.onRenderHour = function (date) { + var render = (options.onRenderHour || function () { return []; })(date); + var res = ['hour']; + if (typeof render === 'string') { + render = [render]; + } + return res.concat((render ? render : [])); + }; + this.onRenderMinute = function (date) { + var render = (options.onRenderMinute || function () { return []; })(date); + var res = ['minute']; + if (typeof render === 'string') { + render = [render]; + } + if (date < this.startDate || date > this.endDate) { + res.push('disabled'); + } else if (Math.floor(this.date.getUTCMinutes() / this.minuteStep) === Math.floor(date.getUTCMinutes() / this.minuteStep)) { + res.push('active'); + } + return res.concat((render ? render : [])); + }; + this.onRenderYear = function (date) { + var render = (options.onRenderYear || function () { return []; })(date); + var res = ['year']; + if (typeof render === 'string') { + render = [render]; + } + if (this.date.getUTCFullYear() === date.getUTCFullYear()) { + res.push('active'); + } + var currentYear = date.getUTCFullYear(); + var endYear = this.endDate.getUTCFullYear(); + if (date < this.startDate || currentYear > endYear) { + res.push('disabled'); + } + return res.concat((render ? render : [])); + } + this.onRenderMonth = function (date) { + var render = (options.onRenderMonth || function () { return []; })(date); + var res = ['month']; + if (typeof render === 'string') { + render = [render]; + } + return res.concat((render ? render : [])); + } + this.startDate = new Date(-8639968443048000); + this.endDate = new Date(8639968443048000); + this.datesDisabled = []; + this.daysOfWeekDisabled = []; + this.setStartDate(options.startDate || this.element.data('date-startdate')); + this.setEndDate(options.endDate || this.element.data('date-enddate')); + this.setDatesDisabled(options.datesDisabled || this.element.data('date-dates-disabled')); + this.setDaysOfWeekDisabled(options.daysOfWeekDisabled || this.element.data('date-days-of-week-disabled')); + this.setMinutesDisabled(options.minutesDisabled || this.element.data('date-minute-disabled')); + this.setHoursDisabled(options.hoursDisabled || this.element.data('date-hour-disabled')); + this.fillDow(); + this.fillMonths(); + this.update(); + this.showMode(); + + if (this.isInline) { + this.show(); + } + }; + + Datetimepicker.prototype = { + constructor: Datetimepicker, + + _events: [], + _attachEvents: function () { + this._detachEvents(); + if (this.isInput) { // single input + this._events = [ + [this.element, { + focus: $.proxy(this.show, this), + keyup: $.proxy(this.update, this), + keydown: $.proxy(this.keydown, this) + }] + ]; + } + else if (this.component && this.hasInput) { // component: input + button + this._events = [ + // For components that are not readonly, allow keyboard nav + [this.element.find('input'), { + focus: $.proxy(this.show, this), + keyup: $.proxy(this.update, this), + keydown: $.proxy(this.keydown, this) + }], + [this.component, { + click: $.proxy(this.show, this) + }] + ]; + if (this.componentReset) { + this._events.push([ + this.componentReset, + {click: $.proxy(this.reset, this)} + ]); + } + } + else if (this.element.is('div')) { // inline datetimepicker + this.isInline = true; + } + else { + this._events = [ + [this.element, { + click: $.proxy(this.show, this) + }] + ]; + } + for (var i = 0, el, ev; i < this._events.length; i++) { + el = this._events[i][0]; + ev = this._events[i][1]; + el.on(ev); + } + }, + + _detachEvents: function () { + for (var i = 0, el, ev; i < this._events.length; i++) { + el = this._events[i][0]; + ev = this._events[i][1]; + el.off(ev); + } + this._events = []; + }, + + show: function (e) { + this.picker.show(); + this.height = this.component ? this.component.outerHeight() : this.element.outerHeight(); + if (this.forceParse) { + this.update(); + } + this.place(); + $(window).on('resize', $.proxy(this.place, this)); + if (e) { + e.stopPropagation(); + e.preventDefault(); + } + this.isVisible = true; + this.element.trigger({ + type: 'show', + date: this.date + }); + }, + + hide: function () { + if (!this.isVisible) return; + if (this.isInline) return; + this.picker.hide(); + $(window).off('resize', this.place); + this.viewMode = this.startViewMode; + this.showMode(); + if (!this.isInput) { + $(document).off('mousedown', this.hide); + } + + if ( + this.forceParse && + ( + this.isInput && this.element.val() || + this.hasInput && this.element.find('input').val() + ) + ) + this.setValue(); + this.isVisible = false; + this.element.trigger({ + type: 'hide', + date: this.date + }); + }, + + remove: function () { + this._detachEvents(); + $(document).off('mousedown', this.clickedOutside); + this.picker.remove(); + delete this.picker; + delete this.element.data().datetimepicker; + }, + + getDate: function () { + var d = this.getUTCDate(); + if (d === null) { + return null; + } + return new Date(d.getTime() + (d.getTimezoneOffset() * 60000)); + }, + + getUTCDate: function () { + return this.date; + }, + + getInitialDate: function () { + return this.initialDate + }, + + setInitialDate: function (initialDate) { + this.initialDate = initialDate; + }, + + setDate: function (d) { + this.setUTCDate(new Date(d.getTime() - (d.getTimezoneOffset() * 60000))); + }, + + setUTCDate: function (d) { + if (d >= this.startDate && d <= this.endDate) { + this.date = d; + this.setValue(); + this.viewDate = this.date; + this.fill(); + } else { + this.element.trigger({ + type: 'outOfRange', + date: d, + startDate: this.startDate, + endDate: this.endDate + }); + } + }, + + setFormat: function (format) { + this.format = DPGlobal.parseFormat(format, this.formatType); + var element; + if (this.isInput) { + element = this.element; + } else if (this.component) { + element = this.element.find('input'); + } + if (element && element.val()) { + this.setValue(); + } + }, + + setValue: function () { + var formatted = this.getFormattedDate(); + if (!this.isInput) { + if (this.component) { + this.element.find('input').val(formatted); + } + this.element.data('date', formatted); + } else { + this.element.val(formatted); + } + if (this.linkField) { + $('#' + this.linkField).val(this.getFormattedDate(this.linkFormat)); + } + }, + + getFormattedDate: function (format) { + format = format || this.format; + return DPGlobal.formatDate(this.date, format, this.language, this.formatType, this.timezone); + }, + + setStartDate: function (startDate) { + this.startDate = startDate || this.startDate; + if (this.startDate.valueOf() !== 8639968443048000) { + this.startDate = DPGlobal.parseDate(this.startDate, this.format, this.language, this.formatType, this.timezone); + } + this.update(); + this.updateNavArrows(); + }, + + setEndDate: function (endDate) { + this.endDate = endDate || this.endDate; + if (this.endDate.valueOf() !== 8639968443048000) { + this.endDate = DPGlobal.parseDate(this.endDate, this.format, this.language, this.formatType, this.timezone); + } + this.update(); + this.updateNavArrows(); + }, + + setDatesDisabled: function (datesDisabled) { + this.datesDisabled = datesDisabled || []; + if (!$.isArray(this.datesDisabled)) { + this.datesDisabled = this.datesDisabled.split(/,\s*/); + } + var mThis = this; + this.datesDisabled = $.map(this.datesDisabled, function (d) { + return DPGlobal.parseDate(d, mThis.format, mThis.language, mThis.formatType, mThis.timezone).toDateString(); + }); + this.update(); + this.updateNavArrows(); + }, + + setTitle: function (selector, value) { + return this.picker.find(selector) + .find('th:eq(1)') + .text(this.title === false ? value : this.title); + }, + + setDaysOfWeekDisabled: function (daysOfWeekDisabled) { + this.daysOfWeekDisabled = daysOfWeekDisabled || []; + if (!$.isArray(this.daysOfWeekDisabled)) { + this.daysOfWeekDisabled = this.daysOfWeekDisabled.split(/,\s*/); + } + this.daysOfWeekDisabled = $.map(this.daysOfWeekDisabled, function (d) { + return parseInt(d, 10); + }); + this.update(); + this.updateNavArrows(); + }, + + setMinutesDisabled: function (minutesDisabled) { + this.minutesDisabled = minutesDisabled || []; + if (!$.isArray(this.minutesDisabled)) { + this.minutesDisabled = this.minutesDisabled.split(/,\s*/); + } + this.minutesDisabled = $.map(this.minutesDisabled, function (d) { + return parseInt(d, 10); + }); + this.update(); + this.updateNavArrows(); + }, + + setHoursDisabled: function (hoursDisabled) { + this.hoursDisabled = hoursDisabled || []; + if (!$.isArray(this.hoursDisabled)) { + this.hoursDisabled = this.hoursDisabled.split(/,\s*/); + } + this.hoursDisabled = $.map(this.hoursDisabled, function (d) { + return parseInt(d, 10); + }); + this.update(); + this.updateNavArrows(); + }, + + place: function () { + if (this.isInline) return; + + if (!this.zIndex) { + var index_highest = 0; + $('div').each(function () { + var index_current = parseInt($(this).css('zIndex'), 10); + if (index_current > index_highest) { + index_highest = index_current; + } + }); + this.zIndex = index_highest + 10; + } + + var offset, top, left, containerOffset; + if (this.container instanceof $) { + containerOffset = this.container.offset(); + } else { + containerOffset = $(this.container).offset(); + } + + if (this.component) { + offset = this.component.offset(); + left = offset.left; + if (this.pickerPosition === 'bottom-left' || this.pickerPosition === 'top-left') { + left += this.component.outerWidth() - this.picker.outerWidth(); + } + } else { + offset = this.element.offset(); + left = offset.left; + if (this.pickerPosition === 'bottom-left' || this.pickerPosition === 'top-left') { + left += this.element.outerWidth() - this.picker.outerWidth(); + } + } + + var bodyWidth = document.body.clientWidth || window.innerWidth; + if (left + 220 > bodyWidth) { + left = bodyWidth - 220; + } + + if (this.pickerPosition === 'top-left' || this.pickerPosition === 'top-right') { + top = offset.top - this.picker.outerHeight(); + } else { + top = offset.top + this.height; + } + + top = top - containerOffset.top; + left = left - containerOffset.left; + + this.picker.css({ + top: top, + left: left, + zIndex: this.zIndex + }); + }, + + hour_minute: "^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]", + + update: function () { + var date, fromArgs = false; + if (arguments && arguments.length && (typeof arguments[0] === 'string' || arguments[0] instanceof Date)) { + date = arguments[0]; + fromArgs = true; + } else { + date = (this.isInput ? this.element.val() : this.element.find('input').val()) || this.element.data('date') || this.initialDate; + if (typeof date === 'string') { + date = date.replace(/^\s+|\s+$/g,''); + } + } - if (parent.length === 0) { - throw new Error('datetimepicker component should be placed within a non-static positioned container'); - } + if (!date) { + date = new Date(); + fromArgs = false; + } - widget.css({ - top: vertical === 'top' ? 'auto' : position.top + element.outerHeight(), - bottom: vertical === 'top' ? parent.outerHeight() - (parent === element ? 0 : position.top) : 'auto', - left: horizontal === 'left' ? (parent === element ? 0 : position.left) : 'auto', - right: horizontal === 'left' ? 'auto' : parent.outerWidth() - element.outerWidth() - (parent === element ? 0 : position.left) + if (typeof date === "string") { + if (new RegExp(this.hour_minute).test(date) || new RegExp(this.hour_minute + ":[0-5][0-9]").test(date)) { + date = this.getDate() + } + } + + this.date = DPGlobal.parseDate(date, this.format, this.language, this.formatType, this.timezone); + + if (fromArgs) this.setValue(); + + if (this.date < this.startDate) { + this.viewDate = new Date(this.startDate); + } else if (this.date > this.endDate) { + this.viewDate = new Date(this.endDate); + } else { + this.viewDate = new Date(this.date); + } + this.fill(); + }, + + fillDow: function () { + var dowCnt = this.weekStart, + html = '
'; + while (dowCnt < this.weekStart + 7) { + html += ''; + } + html += ''; + this.picker.find('.datetimepicker-days thead').append(html); + }, + + fillMonths: function () { + var html = ''; + var d = new Date(this.viewDate); + for (var i = 0; i < 12; i++) { + d.setUTCMonth(i); + var classes = this.onRenderMonth(d); + html += '' + dates[this.language].monthsShort[i] + ''; + } + this.picker.find('.datetimepicker-months td').html(html); + }, + + fill: function () { + if (!this.date || !this.viewDate) { + return; + } + var d = new Date(this.viewDate), + year = d.getUTCFullYear(), + month = d.getUTCMonth(), + dayMonth = d.getUTCDate(), + hours = d.getUTCHours(), + startYear = this.startDate.getUTCFullYear(), + startMonth = this.startDate.getUTCMonth(), + endYear = this.endDate.getUTCFullYear(), + endMonth = this.endDate.getUTCMonth() + 1, + currentDate = (new UTCDate(this.date.getUTCFullYear(), this.date.getUTCMonth(), this.date.getUTCDate())).valueOf(), + today = new Date(); + this.setTitle('.datetimepicker-days', dates[this.language].months[month] + ' ' + year) + if (this.formatViewType === 'time') { + var formatted = this.getFormattedDate(); + this.setTitle('.datetimepicker-hours', formatted); + this.setTitle('.datetimepicker-minutes', formatted); + } else { + this.setTitle('.datetimepicker-hours', dayMonth + ' ' + dates[this.language].months[month] + ' ' + year); + this.setTitle('.datetimepicker-minutes', dayMonth + ' ' + dates[this.language].months[month] + ' ' + year); + } + this.picker.find('tfoot th.today') + .text(dates[this.language].today || dates['en'].today) + .toggle(this.todayBtn !== false); + this.picker.find('tfoot th.clear') + .text(dates[this.language].clear || dates['en'].clear) + .toggle(this.clearBtn !== false); + this.updateNavArrows(); + this.fillMonths(); + var prevMonth = UTCDate(year, month - 1, 28, 0, 0, 0, 0), + day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth()); + prevMonth.setUTCDate(day); + prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7) % 7); + var nextMonth = new Date(prevMonth); + nextMonth.setUTCDate(nextMonth.getUTCDate() + 42); + nextMonth = nextMonth.valueOf(); + var html = []; + var classes; + while (prevMonth.valueOf() < nextMonth) { + if (prevMonth.getUTCDay() === this.weekStart) { + html.push(''); + } + classes = this.onRenderDay(prevMonth); + if (prevMonth.getUTCFullYear() < year || (prevMonth.getUTCFullYear() === year && prevMonth.getUTCMonth() < month)) { + classes.push('old'); + } else if (prevMonth.getUTCFullYear() > year || (prevMonth.getUTCFullYear() === year && prevMonth.getUTCMonth() > month)) { + classes.push('new'); + } + // Compare internal UTC date with local today, not UTC today + if (this.todayHighlight && + prevMonth.getUTCFullYear() === today.getFullYear() && + prevMonth.getUTCMonth() === today.getMonth() && + prevMonth.getUTCDate() === today.getDate()) { + classes.push('today'); + } + if (prevMonth.valueOf() === currentDate) { + classes.push('active'); + } + if ((prevMonth.valueOf() + 86400000) <= this.startDate || prevMonth.valueOf() > this.endDate || + $.inArray(prevMonth.getUTCDay(), this.daysOfWeekDisabled) !== -1 || + $.inArray(prevMonth.toDateString(), this.datesDisabled) !== -1) { + classes.push('disabled'); + } + html.push(''); + if (prevMonth.getUTCDay() === this.weekEnd) { + html.push(''); + } + prevMonth.setUTCDate(prevMonth.getUTCDate() + 1); + } + this.picker.find('.datetimepicker-days tbody').empty().append(html.join('')); + + html = []; + var txt = '', meridian = '', meridianOld = ''; + var hoursDisabled = this.hoursDisabled || []; + d = new Date(this.viewDate) + for (var i = 0; i < 24; i++) { + d.setUTCHours(i); + classes = this.onRenderHour(d); + if (hoursDisabled.indexOf(i) !== -1) { + classes.push('disabled'); + } + var actual = UTCDate(year, month, dayMonth, i); + // We want the previous hour for the startDate + if ((actual.valueOf() + 3600000) <= this.startDate || actual.valueOf() > this.endDate) { + classes.push('disabled'); + } else if (hours === i) { + classes.push('active'); + } + if (this.showMeridian && dates[this.language].meridiem.length === 2) { + meridian = (i < 12 ? dates[this.language].meridiem[0] : dates[this.language].meridiem[1]); + if (meridian !== meridianOld) { + if (meridianOld !== '') { + html.push(''); + } + html.push('
' + meridian.toUpperCase() + ''); + } + meridianOld = meridian; + txt = (i % 12 ? i % 12 : 12); + if (i < 12) { + classes.push('hour_am'); + } else { + classes.push('hour_pm'); + } + html.push('' + txt + ''); + if (i === 23) { + html.push('
'); + } + } else { + txt = i + ':00'; + html.push('' + txt + ''); + } + } + this.picker.find('.datetimepicker-hours td').html(html.join('')); + + html = []; + txt = ''; + meridian = ''; + meridianOld = ''; + var minutesDisabled = this.minutesDisabled || []; + d = new Date(this.viewDate); + for (var i = 0; i < 60; i += this.minuteStep) { + if (minutesDisabled.indexOf(i) !== -1) continue; + d.setUTCMinutes(i); + d.setUTCSeconds(0); + classes = this.onRenderMinute(d); + if (this.showMeridian && dates[this.language].meridiem.length === 2) { + meridian = (hours < 12 ? dates[this.language].meridiem[0] : dates[this.language].meridiem[1]); + if (meridian !== meridianOld) { + if (meridianOld !== '') { + html.push(''); + } + html.push('
' + meridian.toUpperCase() + ''); + } + meridianOld = meridian; + txt = (hours % 12 ? hours % 12 : 12); + html.push('' + txt + ':' + (i < 10 ? '0' + i : i) + ''); + if (i === 59) { + html.push('
'); + } + } else { + txt = i + ':00'; + html.push('' + hours + ':' + (i < 10 ? '0' + i : i) + ''); + } + } + this.picker.find('.datetimepicker-minutes td').html(html.join('')); + + var currentYear = this.date.getUTCFullYear(); + var months = this.setTitle('.datetimepicker-months', year) + .end() + .find('.month').removeClass('active'); + if (currentYear === year) { + // getUTCMonths() returns 0 based, and we need to select the next one + // To cater bootstrap 2 we don't need to select the next one + months.eq(this.date.getUTCMonth()).addClass('active'); + } + if (year < startYear || year > endYear) { + months.addClass('disabled'); + } + if (year === startYear) { + months.slice(0, startMonth).addClass('disabled'); + } + if (year === endYear) { + months.slice(endMonth).addClass('disabled'); + } + + html = ''; + year = parseInt(year / 10, 10) * 10; + var yearCont = this.setTitle('.datetimepicker-years', year + '-' + (year + 9)) + .end() + .find('td'); + year -= 1; + d = new Date(this.viewDate); + for (var i = -1; i < 11; i++) { + d.setUTCFullYear(year); + classes = this.onRenderYear(d); + if (i === -1 || i === 10) { + classes.push(old); + } + html += '' + year + ''; + year += 1; + } + yearCont.html(html); + this.place(); + }, + + updateNavArrows: function () { + var d = new Date(this.viewDate), + year = d.getUTCFullYear(), + month = d.getUTCMonth(), + day = d.getUTCDate(), + hour = d.getUTCHours(); + switch (this.viewMode) { + case 0: + if (year <= this.startDate.getUTCFullYear() + && month <= this.startDate.getUTCMonth() + && day <= this.startDate.getUTCDate() + && hour <= this.startDate.getUTCHours()) { + this.picker.find('.prev').css({visibility: 'hidden'}); + } else { + this.picker.find('.prev').css({visibility: 'visible'}); + } + if (year >= this.endDate.getUTCFullYear() + && month >= this.endDate.getUTCMonth() + && day >= this.endDate.getUTCDate() + && hour >= this.endDate.getUTCHours()) { + this.picker.find('.next').css({visibility: 'hidden'}); + } else { + this.picker.find('.next').css({visibility: 'visible'}); + } + break; + case 1: + if (year <= this.startDate.getUTCFullYear() + && month <= this.startDate.getUTCMonth() + && day <= this.startDate.getUTCDate()) { + this.picker.find('.prev').css({visibility: 'hidden'}); + } else { + this.picker.find('.prev').css({visibility: 'visible'}); + } + if (year >= this.endDate.getUTCFullYear() + && month >= this.endDate.getUTCMonth() + && day >= this.endDate.getUTCDate()) { + this.picker.find('.next').css({visibility: 'hidden'}); + } else { + this.picker.find('.next').css({visibility: 'visible'}); + } + break; + case 2: + if (year <= this.startDate.getUTCFullYear() + && month <= this.startDate.getUTCMonth()) { + this.picker.find('.prev').css({visibility: 'hidden'}); + } else { + this.picker.find('.prev').css({visibility: 'visible'}); + } + if (year >= this.endDate.getUTCFullYear() + && month >= this.endDate.getUTCMonth()) { + this.picker.find('.next').css({visibility: 'hidden'}); + } else { + this.picker.find('.next').css({visibility: 'visible'}); + } + break; + case 3: + case 4: + if (year <= this.startDate.getUTCFullYear()) { + this.picker.find('.prev').css({visibility: 'hidden'}); + } else { + this.picker.find('.prev').css({visibility: 'visible'}); + } + if (year >= this.endDate.getUTCFullYear()) { + this.picker.find('.next').css({visibility: 'hidden'}); + } else { + this.picker.find('.next').css({visibility: 'visible'}); + } + break; + } + }, + + mousewheel: function (e) { + + e.preventDefault(); + e.stopPropagation(); + + if (this.wheelPause) { + return; + } + + this.wheelPause = true; + + var originalEvent = e.originalEvent; + + var delta = originalEvent.wheelDelta; + + var mode = delta > 0 ? 1 : (delta === 0) ? 0 : -1; + + if (this.wheelViewModeNavigationInverseDirection) { + mode = -mode; + } + + this.showMode(mode); + + setTimeout($.proxy(function () { + + this.wheelPause = false + + }, this), this.wheelViewModeNavigationDelay); + + }, + + click: function (e) { + e.stopPropagation(); + e.preventDefault(); + var target = $(e.target).closest('span, td, th, legend'); + if (target.is('.' + this.icontype)) { + target = $(target).parent().closest('span, td, th, legend'); + } + if (target.length === 1) { + if (target.is('.disabled')) { + this.element.trigger({ + type: 'outOfRange', + date: this.viewDate, + startDate: this.startDate, + endDate: this.endDate + }); + return; + } + switch (target[0].nodeName.toLowerCase()) { + case 'th': + switch (target[0].className) { + case 'switch': + this.showMode(1); + break; + case 'prev': + case 'next': + var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1); + switch (this.viewMode) { + case 0: + this.viewDate = this.moveHour(this.viewDate, dir); + break; + case 1: + this.viewDate = this.moveDate(this.viewDate, dir); + break; + case 2: + this.viewDate = this.moveMonth(this.viewDate, dir); + break; + case 3: + case 4: + this.viewDate = this.moveYear(this.viewDate, dir); + break; + } + this.fill(); + this.element.trigger({ + type: target[0].className + ':' + this.convertViewModeText(this.viewMode), + date: this.viewDate, + startDate: this.startDate, + endDate: this.endDate }); - }, - - notifyEvent = function (e) { - if (e.type === 'dp.change' && ((e.date && e.date.isSame(e.oldDate)) || (!e.date && !e.oldDate))) { - return; - } - element.trigger(e); - }, - - viewUpdate = function (e) { - if (e === 'y') { - e = 'YYYY'; - } - notifyEvent({ - type: 'dp.update', - change: e, - viewDate: viewDate.clone() + break; + case 'clear': + this.reset(); + if (this.autoclose) { + this.hide(); + } + break; + case 'today': + var date = new Date(); + date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0); + + // Respect startDate and endDate. + if (date < this.startDate) date = this.startDate; + else if (date > this.endDate) date = this.endDate; + + this.viewMode = this.startViewMode; + this.showMode(0); + this._setDate(date); + this.fill(); + if (this.autoclose) { + this.hide(); + } + break; + } + break; + case 'span': + if (!target.is('.disabled')) { + var year = this.viewDate.getUTCFullYear(), + month = this.viewDate.getUTCMonth(), + day = this.viewDate.getUTCDate(), + hours = this.viewDate.getUTCHours(), + minutes = this.viewDate.getUTCMinutes(), + seconds = this.viewDate.getUTCSeconds(); + + if (target.is('.month')) { + this.viewDate.setUTCDate(1); + month = target.parent().find('span').index(target); + day = this.viewDate.getUTCDate(); + this.viewDate.setUTCMonth(month); + this.element.trigger({ + type: 'changeMonth', + date: this.viewDate }); - }, - - showMode = function (dir) { - if (!widget) { - return; - } - if (dir) { - currentViewMode = Math.max(minViewModeNumber, Math.min(3, currentViewMode + dir)); - } - widget.find('.datepicker > div').hide().filter('.datepicker-' + datePickerModes[currentViewMode].clsName).show(); - }, - - fillDow = function () { - var row = $(''), - currentDate = viewDate.clone().startOf('w').startOf('d'); - - if (options.calendarWeeks === true) { - row.append($(''); - if (options.calendarWeeks) { - row.append(''); - } - html.push(row); - } - clsNames = ['day']; - if (currentDate.isBefore(viewDate, 'M')) { - clsNames.push('old'); - } - if (currentDate.isAfter(viewDate, 'M')) { - clsNames.push('new'); - } - if (currentDate.isSame(date, 'd') && !unset) { - clsNames.push('active'); - } - if (!isValid(currentDate, 'd')) { - clsNames.push('disabled'); - } - if (currentDate.isSame(getMoment(), 'd')) { - clsNames.push('today'); - } - if (currentDate.day() === 0 || currentDate.day() === 6) { - clsNames.push('weekend'); - } - notifyEvent({ - type: 'dp.classify', - date: currentDate, - classNames: clsNames - }); - row.append(''); - currentDate.add(1, 'd'); - } - - daysView.find('tbody').empty().append(html); - - updateMonths(); - - updateYears(); - - updateDecades(); - }, - - fillHours = function () { - var table = widget.find('.timepicker-hours table'), - currentHour = viewDate.clone().startOf('d'), - html = [], - row = $(''); - - if (viewDate.hour() > 11 && !use24Hours) { - currentHour.hour(12); - } - while (currentHour.isSame(viewDate, 'd') && (use24Hours || (viewDate.hour() < 12 && currentHour.hour() < 12) || viewDate.hour() > 11)) { - if (currentHour.hour() % 4 === 0) { - row = $(''); - html.push(row); - } - row.append(''); - currentHour.add(1, 'h'); - } - table.empty().append(html); - }, - - fillMinutes = function () { - var table = widget.find('.timepicker-minutes table'), - currentMinute = viewDate.clone().startOf('h'), - html = [], - row = $(''), - step = options.stepping === 1 ? 5 : options.stepping; - - while (viewDate.isSame(currentMinute, 'h')) { - if (currentMinute.minute() % (step * 4) === 0) { - row = $(''); - html.push(row); - } - row.append(''); - currentMinute.add(step, 'm'); - } - table.empty().append(html); - }, - - fillSeconds = function () { - var table = widget.find('.timepicker-seconds table'), - currentSecond = viewDate.clone().startOf('m'), - html = [], - row = $(''); - - while (viewDate.isSame(currentSecond, 'm')) { - if (currentSecond.second() % 20 === 0) { - row = $(''); - html.push(row); - } - row.append(''); - currentSecond.add(5, 's'); - } - - table.empty().append(html); - }, - - fillTime = function () { - var toggle, newDate, timeComponents = widget.find('.timepicker span[data-time-component]'); - - if (!use24Hours) { - toggle = widget.find('.timepicker [data-action=togglePeriod]'); - newDate = date.clone().add((date.hours() >= 12) ? -12 : 12, 'h'); - - toggle.text(date.format('A')); - - if (isValid(newDate, 'h')) { - toggle.removeClass('disabled'); - } else { - toggle.addClass('disabled'); - } - } - timeComponents.filter('[data-time-component=hours]').text(date.format(use24Hours ? 'HH' : 'hh')); - timeComponents.filter('[data-time-component=minutes]').text(date.format('mm')); - timeComponents.filter('[data-time-component=seconds]').text(date.format('ss')); - - fillHours(); - fillMinutes(); - fillSeconds(); - }, - - update = function () { - if (!widget) { - return; - } - fillDate(); - fillTime(); - }, - - setValue = function (targetMoment) { - var oldDate = unset ? null : date; - - // case of calling setValue(null or false) - if (!targetMoment) { - unset = true; - input.val(''); - element.data('date', ''); - notifyEvent({ - type: 'dp.change', - date: false, - oldDate: oldDate - }); - update(); - return; - } - - targetMoment = targetMoment.clone().locale(options.locale); - - if (hasTimeZone()) { - targetMoment.tz(options.timeZone); - } - - if (options.stepping !== 1) { - targetMoment.minutes((Math.round(targetMoment.minutes() / options.stepping) * options.stepping)).seconds(0); - - while (options.minDate && targetMoment.isBefore(options.minDate)) { - targetMoment.add(options.stepping, 'minutes'); - } - } - - if (isValid(targetMoment)) { - date = targetMoment; - viewDate = date.clone(); - input.val(date.format(actualFormat)); - element.data('date', date.format(actualFormat)); - unset = false; - update(); - notifyEvent({ - type: 'dp.change', - date: date.clone(), - oldDate: oldDate - }); - } else { - if (!options.keepInvalid) { - input.val(unset ? '' : date.format(actualFormat)); - } else { - notifyEvent({ - type: 'dp.change', - date: targetMoment, - oldDate: oldDate - }); - } - notifyEvent({ - type: 'dp.error', - date: targetMoment, - oldDate: oldDate - }); - } - }, - - /** - * Hides the widget. Possibly will emit dp.hide - */ - hide = function () { - var transitioning = false; - if (!widget) { - return picker; - } - // Ignore event if in the middle of a picker transition - widget.find('.collapse').each(function () { - var collapseData = $(this).data('collapse'); - if (collapseData && collapseData.transitioning) { - transitioning = true; - return false; - } - return true; + if (this.viewSelect >= 4) { + this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0)); + } + } else if (target.is('.hour')) { + hours = parseInt(target.text(), 10) || 0; + if (target.hasClass('hour_am') || target.hasClass('hour_pm')) { + if (hours === 12 && target.hasClass('hour_am')) { + hours = 0; + } else if (hours !== 12 && target.hasClass('hour_pm')) { + hours += 12; + } + } + this.viewDate.setUTCHours(hours); + this.element.trigger({ + type: 'changeHour', + date: this.viewDate }); - if (transitioning) { - return picker; - } - if (component && component.hasClass('btn')) { - component.toggleClass('active'); - } - widget.hide(); - - $(window).off('resize', place); - widget.off('click', '[data-action]'); - widget.off('mousedown', false); - - widget.remove(); - widget = false; - - notifyEvent({ - type: 'dp.hide', - date: date.clone() + if (this.viewSelect >= 1) { + this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0)); + } + } else if (target.is('.minute')) { + minutes = parseInt(target.text().substr(target.text().indexOf(':') + 1), 10) || 0; + this.viewDate.setUTCMinutes(minutes); + this.element.trigger({ + type: 'changeMinute', + date: this.viewDate }); - - input.blur(); - - viewDate = date.clone(); - - return picker; - }, - - clear = function () { - setValue(null); - }, - - parseInputDate = function (inputDate) { - if (options.parseInputDate === undefined) { - if (!moment.isMoment(inputDate) || inputDate instanceof Date) { - inputDate = getMoment(inputDate); - } + if (this.viewSelect >= 0) { + this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0)); + } + } + if (this.viewMode !== 0) { + var oldViewMode = this.viewMode; + this.showMode(-1); + this.fill(); + if (oldViewMode === this.viewMode && this.autoclose) { + this.hide(); + } + } else { + this.fill(); + if (this.autoclose) { + this.hide(); + } + } + } + break; + case 'td': + if (target.is('.day') && !target.is('.disabled')) { + var day = parseInt(target.text(), 10) || 1; + var year = this.viewDate.getUTCFullYear(), + month = this.viewDate.getUTCMonth(), + hours = this.viewDate.getUTCHours(), + minutes = this.viewDate.getUTCMinutes(), + seconds = this.viewDate.getUTCSeconds(); + if (target.is('.old')) { + if (month === 0) { + month = 11; + year -= 1; } else { - inputDate = options.parseInputDate(inputDate); - } - //inputDate.locale(options.locale); - return inputDate; - }, - - /******************************************************************************** - * - * Widget UI interaction functions - * - ********************************************************************************/ - actions = { - next: function () { - var navFnc = datePickerModes[currentViewMode].navFnc; - viewDate.add(datePickerModes[currentViewMode].navStep, navFnc); - fillDate(); - viewUpdate(navFnc); - }, - - previous: function () { - var navFnc = datePickerModes[currentViewMode].navFnc; - viewDate.subtract(datePickerModes[currentViewMode].navStep, navFnc); - fillDate(); - viewUpdate(navFnc); - }, - - pickerSwitch: function () { - showMode(1); - }, - - selectMonth: function (e) { - var month = $(e.target).closest('tbody').find('span').index($(e.target)); - viewDate.month(month); - if (currentViewMode === minViewModeNumber) { - setValue(date.clone().year(viewDate.year()).month(viewDate.month())); - if (!options.inline) { - hide(); - } - } else { - showMode(-1); - fillDate(); - } - viewUpdate('M'); - }, - - selectYear: function (e) { - var year = parseInt($(e.target).text(), 10) || 0; - viewDate.year(year); - if (currentViewMode === minViewModeNumber) { - setValue(date.clone().year(viewDate.year())); - if (!options.inline) { - hide(); - } - } else { - showMode(-1); - fillDate(); - } - viewUpdate('YYYY'); - }, - - selectDecade: function (e) { - var year = parseInt($(e.target).data('selection'), 10) || 0; - viewDate.year(year); - if (currentViewMode === minViewModeNumber) { - setValue(date.clone().year(viewDate.year())); - if (!options.inline) { - hide(); - } - } else { - showMode(-1); - fillDate(); - } - viewUpdate('YYYY'); - }, - - selectDay: function (e) { - var day = viewDate.clone(); - if ($(e.target).is('.old')) { - day.subtract(1, 'M'); - } - if ($(e.target).is('.new')) { - day.add(1, 'M'); - } - setValue(day.date(parseInt($(e.target).text(), 10))); - if (!hasTime() && !options.keepOpen && !options.inline) { - hide(); - } - }, - - incrementHours: function () { - var newDate = date.clone().add(1, 'h'); - if (isValid(newDate, 'h')) { - setValue(newDate); - } - }, - - incrementMinutes: function () { - var newDate = date.clone().add(options.stepping, 'm'); - if (isValid(newDate, 'm')) { - setValue(newDate); - } - }, - - incrementSeconds: function () { - var newDate = date.clone().add(1, 's'); - if (isValid(newDate, 's')) { - setValue(newDate); - } - }, - - decrementHours: function () { - var newDate = date.clone().subtract(1, 'h'); - if (isValid(newDate, 'h')) { - setValue(newDate); - } - }, - - decrementMinutes: function () { - var newDate = date.clone().subtract(options.stepping, 'm'); - if (isValid(newDate, 'm')) { - setValue(newDate); - } - }, - - decrementSeconds: function () { - var newDate = date.clone().subtract(1, 's'); - if (isValid(newDate, 's')) { - setValue(newDate); - } - }, - - togglePeriod: function () { - setValue(date.clone().add((date.hours() >= 12) ? -12 : 12, 'h')); - }, - - togglePicker: function (e) { - var $this = $(e.target), - $parent = $this.closest('ul'), - expanded = $parent.find('.in'), - closed = $parent.find('.collapse:not(.in)'), - collapseData; - - if (expanded && expanded.length) { - collapseData = expanded.data('collapse'); - if (collapseData && collapseData.transitioning) { - return; - } - if (expanded.collapse) { // if collapse plugin is available through bootstrap.js then use it - expanded.collapse('hide'); - closed.collapse('show'); - } else { // otherwise just toggle in class on the two views - expanded.removeClass('in'); - closed.addClass('in'); - } - if ($this.is('span')) { - $this.toggleClass(options.icons.time + ' ' + options.icons.date); - } else { - $this.find('span').toggleClass(options.icons.time + ' ' + options.icons.date); - } - - // NOTE: uncomment if toggled state will be restored in show() - //if (component) { - // component.find('span').toggleClass(options.icons.time + ' ' + options.icons.date); - //} - } - }, - - showPicker: function () { - widget.find('.timepicker > div:not(.timepicker-picker)').hide(); - widget.find('.timepicker .timepicker-picker').show(); - }, - - showHours: function () { - widget.find('.timepicker .timepicker-picker').hide(); - widget.find('.timepicker .timepicker-hours').show(); - }, - - showMinutes: function () { - widget.find('.timepicker .timepicker-picker').hide(); - widget.find('.timepicker .timepicker-minutes').show(); - }, - - showSeconds: function () { - widget.find('.timepicker .timepicker-picker').hide(); - widget.find('.timepicker .timepicker-seconds').show(); - }, - - selectHour: function (e) { - var hour = parseInt($(e.target).text(), 10); - - if (!use24Hours) { - if (date.hours() >= 12) { - if (hour !== 12) { - hour += 12; - } - } else { - if (hour === 12) { - hour = 0; - } - } - } - setValue(date.clone().hours(hour)); - actions.showPicker.call(picker); - }, - - selectMinute: function (e) { - setValue(date.clone().minutes(parseInt($(e.target).text(), 10))); - actions.showPicker.call(picker); - }, - - selectSecond: function (e) { - setValue(date.clone().seconds(parseInt($(e.target).text(), 10))); - actions.showPicker.call(picker); - }, - - clear: clear, - - today: function () { - var todaysDate = getMoment(); - if (isValid(todaysDate, 'd')) { - setValue(todaysDate); - } - }, - - close: hide - }, - - doAction = function (e) { - if ($(e.currentTarget).is('.disabled')) { - return false; - } - actions[$(e.currentTarget).data('action')].apply(picker, arguments); - return false; - }, - - /** - * Shows the widget. Possibly will emit dp.show and dp.change - */ - show = function () { - var currentMoment, - useCurrentGranularity = { - 'year': function (m) { - return m.month(0).date(1).hours(0).seconds(0).minutes(0); - }, - 'month': function (m) { - return m.date(1).hours(0).seconds(0).minutes(0); - }, - 'day': function (m) { - return m.hours(0).seconds(0).minutes(0); - }, - 'hour': function (m) { - return m.seconds(0).minutes(0); - }, - 'minute': function (m) { - return m.seconds(0); - } - }; - - if (input.prop('disabled') || (!options.ignoreReadonly && input.prop('readonly')) || widget) { - return picker; - } - if (input.val() !== undefined && input.val().trim().length !== 0) { - setValue(parseInputDate(input.val().trim())); - } else if (unset && options.useCurrent && (options.inline || (input.is('input') && input.val().trim().length === 0))) { - currentMoment = getMoment(); - if (typeof options.useCurrent === 'string') { - currentMoment = useCurrentGranularity[options.useCurrent](currentMoment); - } - setValue(currentMoment); - } - widget = getTemplate(); - - fillDow(); - fillMonths(); - - widget.find('.timepicker-hours').hide(); - widget.find('.timepicker-minutes').hide(); - widget.find('.timepicker-seconds').hide(); - - update(); - showMode(); - - $(window).on('resize', place); - widget.on('click', '[data-action]', doAction); // this handles clicks on the widget - widget.on('mousedown', false); - - if (component && component.hasClass('btn')) { - component.toggleClass('active'); - } - place(); - widget.show(); - if (options.focusOnShow && !input.is(':focus')) { - input.focus(); - } - - notifyEvent({ - type: 'dp.show' - }); - return picker; - }, - - /** - * Shows or hides the widget - */ - toggle = function () { - return (widget ? hide() : show()); - }, - - keydown = function (e) { - var handler = null, - index, - index2, - pressedKeys = [], - pressedModifiers = {}, - currentKey = e.which, - keyBindKeys, - allModifiersPressed, - pressed = 'p'; - - keyState[currentKey] = pressed; - - for (index in keyState) { - if (keyState.hasOwnProperty(index) && keyState[index] === pressed) { - pressedKeys.push(index); - if (parseInt(index, 10) !== currentKey) { - pressedModifiers[index] = true; - } - } - } - - for (index in options.keyBinds) { - if (options.keyBinds.hasOwnProperty(index) && typeof (options.keyBinds[index]) === 'function') { - keyBindKeys = index.split(' '); - if (keyBindKeys.length === pressedKeys.length && keyMap[currentKey] === keyBindKeys[keyBindKeys.length - 1]) { - allModifiersPressed = true; - for (index2 = keyBindKeys.length - 2; index2 >= 0; index2--) { - if (!(keyMap[keyBindKeys[index2]] in pressedModifiers)) { - allModifiersPressed = false; - break; - } - } - if (allModifiersPressed) { - handler = options.keyBinds[index]; - break; - } - } - } - } - - if (handler) { - handler.call(picker, widget); - e.stopPropagation(); - e.preventDefault(); - } - }, - - keyup = function (e) { - keyState[e.which] = 'r'; - e.stopPropagation(); - e.preventDefault(); - }, - - change = function (e) { - var val = $(e.target).val().trim(), - parsedDate = val ? parseInputDate(val) : null; - setValue(parsedDate); - e.stopImmediatePropagation(); - return false; - }, - - attachDatePickerElementEvents = function () { - input.on({ - 'change': change, - 'blur': options.debug ? '' : hide, - 'keydown': keydown, - 'keyup': keyup, - 'focus': options.allowInputToggle ? show : '' - }); - - if (element.is('input')) { - input.on({ - 'focus': show - }); - } else if (component) { - component.on('click', toggle); - component.on('mousedown', false); + month -= 1; } - }, - - detachDatePickerElementEvents = function () { - input.off({ - 'change': change, - 'blur': blur, - 'keydown': keydown, - 'keyup': keyup, - 'focus': options.allowInputToggle ? hide : '' - }); - - if (element.is('input')) { - input.off({ - 'focus': show - }); - } else if (component) { - component.off('click', toggle); - component.off('mousedown', false); - } - }, - - indexGivenDates = function (givenDatesArray) { - // Store given enabledDates and disabledDates as keys. - // This way we can check their existence in O(1) time instead of looping through whole array. - // (for example: options.enabledDates['2014-02-27'] === true) - var givenDatesIndexed = {}; - $.each(givenDatesArray, function () { - var dDate = parseInputDate(this); - if (dDate.isValid()) { - givenDatesIndexed[dDate.format('YYYY-MM-DD')] = true; - } - }); - return (Object.keys(givenDatesIndexed).length) ? givenDatesIndexed : false; - }, - - indexGivenHours = function (givenHoursArray) { - // Store given enabledHours and disabledHours as keys. - // This way we can check their existence in O(1) time instead of looping through whole array. - // (for example: options.enabledHours['2014-02-27'] === true) - var givenHoursIndexed = {}; - $.each(givenHoursArray, function () { - givenHoursIndexed[this] = true; + } else if (target.is('.new')) { + if (month === 11) { + month = 0; + year += 1; + } else { + month += 1; + } + } + this.viewDate.setUTCFullYear(year); + this.viewDate.setUTCMonth(month, day); + this.element.trigger({ + type: 'changeDay', + date: this.viewDate + }); + if (this.viewSelect >= 2) { + this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0)); + } + } + var oldViewMode = this.viewMode; + this.showMode(-1); + this.fill(); + if (oldViewMode === this.viewMode && this.autoclose) { + this.hide(); + } + break; + } + } + }, + + _setDate: function (date, which) { + if (!which || which === 'date') + this.date = date; + if (!which || which === 'view') + this.viewDate = date; + this.fill(); + this.setValue(); + var element; + if (this.isInput) { + element = this.element; + } else if (this.component) { + element = this.element.find('input'); + } + if (element) { + element.change(); + } + this.element.trigger({ + type: 'changeDate', + date: this.getDate() + }); + if(date === null) + this.date = this.viewDate; + }, + + moveMinute: function (date, dir) { + if (!dir) return date; + var new_date = new Date(date.valueOf()); + //dir = dir > 0 ? 1 : -1; + new_date.setUTCMinutes(new_date.getUTCMinutes() + (dir * this.minuteStep)); + return new_date; + }, + + moveHour: function (date, dir) { + if (!dir) return date; + var new_date = new Date(date.valueOf()); + //dir = dir > 0 ? 1 : -1; + new_date.setUTCHours(new_date.getUTCHours() + dir); + return new_date; + }, + + moveDate: function (date, dir) { + if (!dir) return date; + var new_date = new Date(date.valueOf()); + //dir = dir > 0 ? 1 : -1; + new_date.setUTCDate(new_date.getUTCDate() + dir); + return new_date; + }, + + moveMonth: function (date, dir) { + if (!dir) return date; + var new_date = new Date(date.valueOf()), + day = new_date.getUTCDate(), + month = new_date.getUTCMonth(), + mag = Math.abs(dir), + new_month, test; + dir = dir > 0 ? 1 : -1; + if (mag === 1) { + test = dir === -1 + // If going back one month, make sure month is not current month + // (eg, Mar 31 -> Feb 31 === Feb 28, not Mar 02) + ? function () { + return new_date.getUTCMonth() === month; + } + // If going forward one month, make sure month is as expected + // (eg, Jan 31 -> Feb 31 === Feb 28, not Mar 02) + : function () { + return new_date.getUTCMonth() !== new_month; + }; + new_month = month + dir; + new_date.setUTCMonth(new_month); + // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11 + if (new_month < 0 || new_month > 11) + new_month = (new_month + 12) % 12; + } else { + // For magnitudes >1, move one month at a time... + for (var i = 0; i < mag; i++) + // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)... + new_date = this.moveMonth(new_date, dir); + // ...then reset the day, keeping it in the new month + new_month = new_date.getUTCMonth(); + new_date.setUTCDate(day); + test = function () { + return new_month !== new_date.getUTCMonth(); + }; + } + // Common date-resetting loop -- if date is beyond end of month, make it + // end of month + while (test()) { + new_date.setUTCDate(--day); + new_date.setUTCMonth(new_month); + } + return new_date; + }, + + moveYear: function (date, dir) { + return this.moveMonth(date, dir * 12); + }, + + dateWithinRange: function (date) { + return date >= this.startDate && date <= this.endDate; + }, + + keydown: function (e) { + if (this.picker.is(':not(:visible)')) { + if (e.keyCode === 27) // allow escape to hide and re-show picker + this.show(); + return; + } + var dateChanged = false, + dir, newDate, newViewDate; + switch (e.keyCode) { + case 27: // escape + this.hide(); + e.preventDefault(); + break; + case 37: // left + case 39: // right + if (!this.keyboardNavigation) break; + dir = e.keyCode === 37 ? -1 : 1; + var viewMode = this.viewMode; + if (e.ctrlKey) { + viewMode += 2; + } else if (e.shiftKey) { + viewMode += 1; + } + if (viewMode === 4) { + newDate = this.moveYear(this.date, dir); + newViewDate = this.moveYear(this.viewDate, dir); + } else if (viewMode === 3) { + newDate = this.moveMonth(this.date, dir); + newViewDate = this.moveMonth(this.viewDate, dir); + } else if (viewMode === 2) { + newDate = this.moveDate(this.date, dir); + newViewDate = this.moveDate(this.viewDate, dir); + } else if (viewMode === 1) { + newDate = this.moveHour(this.date, dir); + newViewDate = this.moveHour(this.viewDate, dir); + } else if (viewMode === 0) { + newDate = this.moveMinute(this.date, dir); + newViewDate = this.moveMinute(this.viewDate, dir); + } + if (this.dateWithinRange(newDate)) { + this.date = newDate; + this.viewDate = newViewDate; + this.setValue(); + this.update(); + e.preventDefault(); + dateChanged = true; + } + break; + case 38: // up + case 40: // down + if (!this.keyboardNavigation) break; + dir = e.keyCode === 38 ? -1 : 1; + viewMode = this.viewMode; + if (e.ctrlKey) { + viewMode += 2; + } else if (e.shiftKey) { + viewMode += 1; + } + if (viewMode === 4) { + newDate = this.moveYear(this.date, dir); + newViewDate = this.moveYear(this.viewDate, dir); + } else if (viewMode === 3) { + newDate = this.moveMonth(this.date, dir); + newViewDate = this.moveMonth(this.viewDate, dir); + } else if (viewMode === 2) { + newDate = this.moveDate(this.date, dir * 7); + newViewDate = this.moveDate(this.viewDate, dir * 7); + } else if (viewMode === 1) { + if (this.showMeridian) { + newDate = this.moveHour(this.date, dir * 6); + newViewDate = this.moveHour(this.viewDate, dir * 6); + } else { + newDate = this.moveHour(this.date, dir * 4); + newViewDate = this.moveHour(this.viewDate, dir * 4); + } + } else if (viewMode === 0) { + newDate = this.moveMinute(this.date, dir * 4); + newViewDate = this.moveMinute(this.viewDate, dir * 4); + } + if (this.dateWithinRange(newDate)) { + this.date = newDate; + this.viewDate = newViewDate; + this.setValue(); + this.update(); + e.preventDefault(); + dateChanged = true; + } + break; + case 13: // enter + if (this.viewMode !== 0) { + var oldViewMode = this.viewMode; + this.showMode(-1); + this.fill(); + if (oldViewMode === this.viewMode && this.autoclose) { + this.hide(); + } + } else { + this.fill(); + if (this.autoclose) { + this.hide(); + } + } + e.preventDefault(); + break; + case 9: // tab + this.hide(); + break; + } + if (dateChanged) { + var element; + if (this.isInput) { + element = this.element; + } else if (this.component) { + element = this.element.find('input'); + } + if (element) { + element.change(); + } + this.element.trigger({ + type: 'changeDate', + date: this.getDate() + }); + } + }, + + showMode: function (dir) { + if (dir) { + var newViewMode = Math.max(0, Math.min(DPGlobal.modes.length - 1, this.viewMode + dir)); + if (newViewMode >= this.minView && newViewMode <= this.maxView) { + this.element.trigger({ + type: 'changeMode', + date: this.viewDate, + oldViewMode: this.viewMode, + newViewMode: newViewMode + }); + + this.viewMode = newViewMode; + } + } + /* + vitalets: fixing bug of very special conditions: + jquery 1.7.1 + webkit + show inline datetimepicker in bootstrap popover. + Method show() does not set display css correctly and datetimepicker is not shown. + Changed to .css('display', 'block') solve the problem. + See https://github.com/vitalets/x-editable/issues/37 + + In jquery 1.7.2+ everything works fine. + */ + //this.picker.find('>div').hide().filter('.datetimepicker-'+DPGlobal.modes[this.viewMode].clsName).show(); + this.picker.find('>div').hide().filter('.datetimepicker-' + DPGlobal.modes[this.viewMode].clsName).css('display', 'block'); + this.updateNavArrows(); + }, + + reset: function () { + this._setDate(null, 'date'); + }, + + convertViewModeText: function (viewMode) { + switch (viewMode) { + case 4: + return 'decade'; + case 3: + return 'year'; + case 2: + return 'month'; + case 1: + return 'day'; + case 0: + return 'hour'; + } + } + }; + + var old = $.fn.datetimepicker; + $.fn.datetimepicker = function (option) { + var args = Array.apply(null, arguments); + args.shift(); + var internal_return; + this.each(function () { + var $this = $(this), + data = $this.data('datetimepicker'), + options = typeof option === 'object' && option; + if (!data) { + $this.data('datetimepicker', (data = new Datetimepicker(this, $.extend({}, $.fn.datetimepicker.defaults, options)))); + } + if (typeof option === 'string' && typeof data[option] === 'function') { + internal_return = data[option].apply(data, args); + if (internal_return !== undefined) { + return false; + } + } + }); + if (internal_return !== undefined) + return internal_return; + else + return this; + }; + + $.fn.datetimepicker.defaults = { + }; + $.fn.datetimepicker.Constructor = Datetimepicker; + var dates = $.fn.datetimepicker.dates = { + en: { + days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'], + daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], + daysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'], + months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + meridiem: ['am', 'pm'], + suffix: ['st', 'nd', 'rd', 'th'], + today: 'Today', + clear: 'Clear' + } + }; + + var DPGlobal = { + modes: [ + { + clsName: 'minutes', + navFnc: 'Hours', + navStep: 1 + }, + { + clsName: 'hours', + navFnc: 'Date', + navStep: 1 + }, + { + clsName: 'days', + navFnc: 'Month', + navStep: 1 + }, + { + clsName: 'months', + navFnc: 'FullYear', + navStep: 1 + }, + { + clsName: 'years', + navFnc: 'FullYear', + navStep: 10 + } + ], + isLeapYear: function (year) { + return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)) + }, + getDaysInMonth: function (year, month) { + return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month] + }, + getDefaultFormat: function (type, field) { + if (type === 'standard') { + if (field === 'input') + return 'yyyy-mm-dd hh:ii'; + else + return 'yyyy-mm-dd hh:ii:ss'; + } else if (type === 'php') { + if (field === 'input') + return 'Y-m-d H:i'; + else + return 'Y-m-d H:i:s'; + } else { + throw new Error('Invalid format type.'); + } + }, + validParts: function (type) { + if (type === 'standard') { + return /t|hh?|HH?|p|P|z|Z|ii?|ss?|dd?|DD?|mm?|MM?|yy(?:yy)?/g; + } else if (type === 'php') { + return /[dDjlNwzFmMnStyYaABgGhHis]/g; + } else { + throw new Error('Invalid format type.'); + } + }, + nonpunctuation: /[^ -\/:-@\[-`{-~\t\n\rTZ]+/g, + parseFormat: function (format, type) { + // IE treats \0 as a string end in inputs (truncating the value), + // so it's a bad format delimiter, anyway + var separators = format.replace(this.validParts(type), '\0').split('\0'), + parts = format.match(this.validParts(type)); + if (!separators || !separators.length || !parts || parts.length === 0) { + throw new Error('Invalid date format.'); + } + return {separators: separators, parts: parts}; + }, + parseDate: function (date, format, language, type, timezone) { + if (date instanceof Date) { + var dateUTC = new Date(date.valueOf() - date.getTimezoneOffset() * 60000); + dateUTC.setMilliseconds(0); + return dateUTC; + } + if (/^\d{4}\-\d{1,2}\-\d{1,2}$/.test(date)) { + format = this.parseFormat('yyyy-mm-dd', type); + } + if (/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}$/.test(date)) { + format = this.parseFormat('yyyy-mm-dd hh:ii', type); + } + if (/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}\:\d{1,2}[Z]{0,1}$/.test(date)) { + format = this.parseFormat('yyyy-mm-dd hh:ii:ss', type); + } + if (/^[-+]\d+[dmwy]([\s,]+[-+]\d+[dmwy])*$/.test(date)) { + var part_re = /([-+]\d+)([dmwy])/, + parts = date.match(/([-+]\d+)([dmwy])/g), + part, dir; + date = new Date(); + for (var i = 0; i < parts.length; i++) { + part = part_re.exec(parts[i]); + dir = parseInt(part[1]); + switch (part[2]) { + case 'd': + date.setUTCDate(date.getUTCDate() + dir); + break; + case 'm': + date = Datetimepicker.prototype.moveMonth.call(Datetimepicker.prototype, date, dir); + break; + case 'w': + date.setUTCDate(date.getUTCDate() + dir * 7); + break; + case 'y': + date = Datetimepicker.prototype.moveYear.call(Datetimepicker.prototype, date, dir); + break; + } + } + return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), 0); + } + var parts = date && date.toString().match(this.nonpunctuation) || [], + date = new Date(0, 0, 0, 0, 0, 0, 0), + parsed = {}, + setters_order = ['hh', 'h', 'ii', 'i', 'ss', 's', 'yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'D', 'DD', 'd', 'dd', 'H', 'HH', 'p', 'P', 'z', 'Z'], + setters_map = { + hh: function (d, v) { + return d.setUTCHours(v); + }, + h: function (d, v) { + return d.setUTCHours(v); + }, + HH: function (d, v) { + return d.setUTCHours(v === 12 ? 0 : v); + }, + H: function (d, v) { + return d.setUTCHours(v === 12 ? 0 : v); + }, + ii: function (d, v) { + return d.setUTCMinutes(v); + }, + i: function (d, v) { + return d.setUTCMinutes(v); + }, + ss: function (d, v) { + return d.setUTCSeconds(v); + }, + s: function (d, v) { + return d.setUTCSeconds(v); + }, + yyyy: function (d, v) { + return d.setUTCFullYear(v); + }, + yy: function (d, v) { + return d.setUTCFullYear(2000 + v); + }, + m: function (d, v) { + v -= 1; + while (v < 0) v += 12; + v %= 12; + d.setUTCMonth(v); + while (d.getUTCMonth() !== v) + if (isNaN(d.getUTCMonth())) + return d; + else + d.setUTCDate(d.getUTCDate() - 1); + return d; + }, + d: function (d, v) { + return d.setUTCDate(v); + }, + p: function (d, v) { + return d.setUTCHours(v === 1 ? d.getUTCHours() + 12 : d.getUTCHours()); + }, + z: function () { + return timezone + } + }, + val, filtered, part; + setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m']; + setters_map['dd'] = setters_map['d']; + setters_map['P'] = setters_map['p']; + setters_map['Z'] = setters_map['z']; + date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()); + if (parts.length === format.parts.length) { + for (var i = 0, cnt = format.parts.length; i < cnt; i++) { + val = parseInt(parts[i], 10); + part = format.parts[i]; + if (isNaN(val)) { + switch (part) { + case 'MM': + filtered = $(dates[language].months).filter(function () { + var m = this.slice(0, parts[i].length), + p = parts[i].slice(0, m.length); + return m === p; }); - return (Object.keys(givenHoursIndexed).length) ? givenHoursIndexed : false; - }, - - initFormatting = function () { - var format = options.format || 'L LT'; - - actualFormat = format.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function (formatInput) { - var newinput = date.localeData().longDateFormat(formatInput) || formatInput; - return newinput.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function (formatInput2) { //temp fix for #740 - return date.localeData().longDateFormat(formatInput2) || formatInput2; - }); + val = $.inArray(filtered[0], dates[language].months) + 1; + break; + case 'M': + filtered = $(dates[language].monthsShort).filter(function () { + var m = this.slice(0, parts[i].length), + p = parts[i].slice(0, m.length); + return m.toLowerCase() === p.toLowerCase(); }); - - - parseFormats = options.extraFormats ? options.extraFormats.slice() : []; - if (parseFormats.indexOf(format) < 0 && parseFormats.indexOf(actualFormat) < 0) { - parseFormats.push(actualFormat); - } - - use24Hours = (actualFormat.toLowerCase().indexOf('a') < 1 && actualFormat.replace(/\[.*?\]/g, '').indexOf('h') < 1); - - if (isEnabled('y')) { - minViewModeNumber = 2; - } - if (isEnabled('M')) { - minViewModeNumber = 1; - } - if (isEnabled('d')) { - minViewModeNumber = 0; - } - - currentViewMode = Math.max(minViewModeNumber, currentViewMode); - - if (!unset) { - setValue(date); - } - }; - - /******************************************************************************** - * - * Public API functions - * ===================== - * - * Important: Do not expose direct references to private objects or the options - * object to the outer world. Always return a clone when returning values or make - * a clone when setting a private variable. - * - ********************************************************************************/ - picker.destroy = function () { - ///Destroys the widget and removes all attached event listeners - hide(); - detachDatePickerElementEvents(); - element.removeData('DateTimePicker'); - element.removeData('date'); + val = $.inArray(filtered[0], dates[language].monthsShort) + 1; + break; + case 'p': + case 'P': + val = $.inArray(parts[i].toLowerCase(), dates[language].meridiem); + break; + case 'z': + case 'Z': + timezone; + break; + + } + } + parsed[part] = val; + } + for (var i = 0, s; i < setters_order.length; i++) { + s = setters_order[i]; + if (s in parsed && !isNaN(parsed[s])) + setters_map[s](date, parsed[s]) + } + } + return date; + }, + formatDate: function (date, format, language, type, timezone) { + if (date === null) { + return ''; + } + var val; + if (type === 'standard') { + val = { + t: date.getTime(), + // year + yy: date.getUTCFullYear().toString().substring(2), + yyyy: date.getUTCFullYear(), + // month + m: date.getUTCMonth() + 1, + M: dates[language].monthsShort[date.getUTCMonth()], + MM: dates[language].months[date.getUTCMonth()], + // day + d: date.getUTCDate(), + D: dates[language].daysShort[date.getUTCDay()], + DD: dates[language].days[date.getUTCDay()], + p: (dates[language].meridiem.length === 2 ? dates[language].meridiem[date.getUTCHours() < 12 ? 0 : 1] : ''), + // hour + h: date.getUTCHours(), + // minute + i: date.getUTCMinutes(), + // second + s: date.getUTCSeconds(), + // timezone + z: timezone }; - picker.toggle = toggle; - - picker.show = show; - - picker.hide = hide; - - picker.disable = function () { - ///Disables the input element, the component is attached to, by adding a disabled="true" attribute to it. - ///If the widget was visible before that call it is hidden. Possibly emits dp.hide - hide(); - if (component && component.hasClass('btn')) { - component.addClass('disabled'); - } - input.prop('disabled', true); - return picker; - }; - - picker.enable = function () { - ///Enables the input element, the component is attached to, by removing disabled attribute from it. - if (component && component.hasClass('btn')) { - component.removeClass('disabled'); - } - input.prop('disabled', false); - return picker; - }; - - picker.ignoreReadonly = function (ignoreReadonly) { - if (arguments.length === 0) { - return options.ignoreReadonly; - } - if (typeof ignoreReadonly !== 'boolean') { - throw new TypeError('ignoreReadonly () expects a boolean parameter'); - } - options.ignoreReadonly = ignoreReadonly; - return picker; - }; - - picker.options = function (newOptions) { - if (arguments.length === 0) { - return $.extend(true, {}, options); - } - - if (!(newOptions instanceof Object)) { - throw new TypeError('options() options parameter should be an object'); - } - $.extend(true, options, newOptions); - $.each(options, function (key, value) { - if (picker[key] !== undefined) { - picker[key](value); - } else { - throw new TypeError('option ' + key + ' is not recognized!'); - } - }); - return picker; - }; - - picker.date = function (newDate) { - /// - ///Returns the component's model current date, a moment object or null if not set. - ///date.clone() - /// - /// - ///Sets the components model current moment to it. Passing a null value unsets the components model current moment. Parsing of the newDate parameter is made using moment library with the options.format and options.useStrict components configuration. - ///Takes string, Date, moment, null parameter. - /// - if (arguments.length === 0) { - if (unset) { - return null; - } - return date.clone(); - } - - if (newDate !== null && typeof newDate !== 'string' && !moment.isMoment(newDate) && !(newDate instanceof Date)) { - throw new TypeError('date() parameter must be one of [null, string, moment or Date]'); - } - - setValue(newDate === null ? null : parseInputDate(newDate)); - return picker; - }; - - picker.format = function (newFormat) { - ///test su - ///info about para - ///returns foo - if (arguments.length === 0) { - return options.format; - } - - if ((typeof newFormat !== 'string') && ((typeof newFormat !== 'boolean') || (newFormat !== false))) { - throw new TypeError('format() expects a string or boolean:false parameter ' + newFormat); - } - - options.format = newFormat; - if (actualFormat) { - initFormatting(); // reinit formatting - } - return picker; - }; - - picker.timeZone = function (newZone) { - if (arguments.length === 0) { - return options.timeZone; - } - - if (typeof newZone !== 'string') { - throw new TypeError('newZone() expects a string parameter'); - } - - options.timeZone = newZone; - - return picker; - }; - - picker.dayViewHeaderFormat = function (newFormat) { - if (arguments.length === 0) { - return options.dayViewHeaderFormat; - } - - if (typeof newFormat !== 'string') { - throw new TypeError('dayViewHeaderFormat() expects a string parameter'); - } - - options.dayViewHeaderFormat = newFormat; - return picker; - }; - - picker.extraFormats = function (formats) { - if (arguments.length === 0) { - return options.extraFormats; - } - - if (formats !== false && !(formats instanceof Array)) { - throw new TypeError('extraFormats() expects an array or false parameter'); - } - - options.extraFormats = formats; - if (parseFormats) { - initFormatting(); // reinit formatting - } - return picker; - }; - - picker.disabledDates = function (dates) { - /// - ///Returns an array with the currently set disabled dates on the component. - ///options.disabledDates - /// - /// - ///Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of - ///options.enabledDates if such exist. - ///Takes an [ string or Date or moment ] of values and allows the user to select only from those days. - /// - if (arguments.length === 0) { - return (options.disabledDates ? $.extend({}, options.disabledDates) : options.disabledDates); - } - - if (!dates) { - options.disabledDates = false; - update(); - return picker; - } - if (!(dates instanceof Array)) { - throw new TypeError('disabledDates() expects an array parameter'); - } - options.disabledDates = indexGivenDates(dates); - options.enabledDates = false; - update(); - return picker; - }; - - picker.enabledDates = function (dates) { - /// - ///Returns an array with the currently set enabled dates on the component. - ///options.enabledDates - /// - /// - ///Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of options.disabledDates if such exist. - ///Takes an [ string or Date or moment ] of values and allows the user to select only from those days. - /// - if (arguments.length === 0) { - return (options.enabledDates ? $.extend({}, options.enabledDates) : options.enabledDates); - } - - if (!dates) { - options.enabledDates = false; - update(); - return picker; - } - if (!(dates instanceof Array)) { - throw new TypeError('enabledDates() expects an array parameter'); - } - options.enabledDates = indexGivenDates(dates); - options.disabledDates = false; - update(); - return picker; - }; - - picker.daysOfWeekDisabled = function (daysOfWeekDisabled) { - if (arguments.length === 0) { - return options.daysOfWeekDisabled.splice(0); - } - - if ((typeof daysOfWeekDisabled === 'boolean') && !daysOfWeekDisabled) { - options.daysOfWeekDisabled = false; - update(); - return picker; - } - - if (!(daysOfWeekDisabled instanceof Array)) { - throw new TypeError('daysOfWeekDisabled() expects an array parameter'); - } - options.daysOfWeekDisabled = daysOfWeekDisabled.reduce(function (previousValue, currentValue) { - currentValue = parseInt(currentValue, 10); - if (currentValue > 6 || currentValue < 0 || isNaN(currentValue)) { - return previousValue; - } - if (previousValue.indexOf(currentValue) === -1) { - previousValue.push(currentValue); - } - return previousValue; - }, []).sort(); - if (options.useCurrent && !options.keepInvalid) { - var tries = 0; - while (!isValid(date, 'd')) { - date.add(1, 'd'); - if (tries === 31) { - throw 'Tried 31 times to find a valid date'; - } - tries++; - } - setValue(date); - } - update(); - return picker; - }; - - picker.maxDate = function (maxDate) { - if (arguments.length === 0) { - return options.maxDate ? options.maxDate.clone() : options.maxDate; - } - - if ((typeof maxDate === 'boolean') && maxDate === false) { - options.maxDate = false; - update(); - return picker; - } - - if (typeof maxDate === 'string') { - if (maxDate === 'now' || maxDate === 'moment') { - maxDate = getMoment(); - } - } - - var parsedDate = parseInputDate(maxDate); - - if (!parsedDate.isValid()) { - throw new TypeError('maxDate() Could not parse date parameter: ' + maxDate); - } - if (options.minDate && parsedDate.isBefore(options.minDate)) { - throw new TypeError('maxDate() date parameter is before options.minDate: ' + parsedDate.format(actualFormat)); - } - options.maxDate = parsedDate; - if (options.useCurrent && !options.keepInvalid && date.isAfter(maxDate)) { - setValue(options.maxDate); - } - if (viewDate.isAfter(parsedDate)) { - viewDate = parsedDate.clone().subtract(options.stepping, 'm'); - } - update(); - return picker; - }; - - picker.minDate = function (minDate) { - if (arguments.length === 0) { - return options.minDate ? options.minDate.clone() : options.minDate; - } - - if ((typeof minDate === 'boolean') && minDate === false) { - options.minDate = false; - update(); - return picker; - } - - if (typeof minDate === 'string') { - if (minDate === 'now' || minDate === 'moment') { - minDate = getMoment(); - } - } - - var parsedDate = parseInputDate(minDate); - - if (!parsedDate.isValid()) { - throw new TypeError('minDate() Could not parse date parameter: ' + minDate); - } - if (options.maxDate && parsedDate.isAfter(options.maxDate)) { - throw new TypeError('minDate() date parameter is after options.maxDate: ' + parsedDate.format(actualFormat)); - } - options.minDate = parsedDate; - if (options.useCurrent && !options.keepInvalid && date.isBefore(minDate)) { - setValue(options.minDate); - } - if (viewDate.isBefore(parsedDate)) { - viewDate = parsedDate.clone().add(options.stepping, 'm'); - } - update(); - return picker; - }; - - picker.defaultDate = function (defaultDate) { - /// - ///Returns a moment with the options.defaultDate option configuration or false if not set - ///date.clone() - /// - /// - ///Will set the picker's inital date. If a boolean:false value is passed the options.defaultDate parameter is cleared. - ///Takes a string, Date, moment, boolean:false - /// - if (arguments.length === 0) { - return options.defaultDate ? options.defaultDate.clone() : options.defaultDate; - } - if (!defaultDate) { - options.defaultDate = false; - return picker; - } - - if (typeof defaultDate === 'string') { - if (defaultDate === 'now' || defaultDate === 'moment') { - defaultDate = getMoment(); - } else { - defaultDate = getMoment(defaultDate); - } - } - - var parsedDate = parseInputDate(defaultDate); - if (!parsedDate.isValid()) { - throw new TypeError('defaultDate() Could not parse date parameter: ' + defaultDate); - } - if (!isValid(parsedDate)) { - throw new TypeError('defaultDate() date passed is invalid according to component setup validations'); - } - - options.defaultDate = parsedDate; - - if ((options.defaultDate && options.inline) || input.val().trim() === '') { - setValue(options.defaultDate); - } - return picker; - }; - - picker.locale = function (locale) { - if (arguments.length === 0) { - return options.locale; - } - - if (!moment.localeData(locale)) { - throw new TypeError('locale() locale ' + locale + ' is not loaded from moment locales!'); - } - - options.locale = locale; - date.locale(options.locale); - viewDate.locale(options.locale); - - if (actualFormat) { - initFormatting(); // reinit formatting - } - if (widget) { - hide(); - show(); - } - return picker; - }; - - picker.stepping = function (stepping) { - if (arguments.length === 0) { - return options.stepping; - } - - stepping = parseInt(stepping, 10); - if (isNaN(stepping) || stepping < 1) { - stepping = 1; - } - options.stepping = stepping; - return picker; - }; - - picker.useCurrent = function (useCurrent) { - var useCurrentOptions = ['year', 'month', 'day', 'hour', 'minute']; - if (arguments.length === 0) { - return options.useCurrent; - } - - if ((typeof useCurrent !== 'boolean') && (typeof useCurrent !== 'string')) { - throw new TypeError('useCurrent() expects a boolean or string parameter'); - } - if (typeof useCurrent === 'string' && useCurrentOptions.indexOf(useCurrent.toLowerCase()) === -1) { - throw new TypeError('useCurrent() expects a string parameter of ' + useCurrentOptions.join(', ')); - } - options.useCurrent = useCurrent; - return picker; - }; - - picker.collapse = function (collapse) { - if (arguments.length === 0) { - return options.collapse; - } - - if (typeof collapse !== 'boolean') { - throw new TypeError('collapse() expects a boolean parameter'); - } - if (options.collapse === collapse) { - return picker; - } - options.collapse = collapse; - if (widget) { - hide(); - show(); - } - return picker; - }; - - picker.icons = function (icons) { - if (arguments.length === 0) { - return $.extend({}, options.icons); - } - - if (!(icons instanceof Object)) { - throw new TypeError('icons() expects parameter to be an Object'); - } - $.extend(options.icons, icons); - if (widget) { - hide(); - show(); - } - return picker; - }; - - picker.tooltips = function (tooltips) { - if (arguments.length === 0) { - return $.extend({}, options.tooltips); - } - - if (!(tooltips instanceof Object)) { - throw new TypeError('tooltips() expects parameter to be an Object'); - } - $.extend(options.tooltips, tooltips); - if (widget) { - hide(); - show(); - } - return picker; - }; - - picker.useStrict = function (useStrict) { - if (arguments.length === 0) { - return options.useStrict; - } - - if (typeof useStrict !== 'boolean') { - throw new TypeError('useStrict() expects a boolean parameter'); - } - options.useStrict = useStrict; - return picker; - }; - - picker.sideBySide = function (sideBySide) { - if (arguments.length === 0) { - return options.sideBySide; - } - - if (typeof sideBySide !== 'boolean') { - throw new TypeError('sideBySide() expects a boolean parameter'); - } - options.sideBySide = sideBySide; - if (widget) { - hide(); - show(); - } - return picker; - }; - - picker.viewMode = function (viewMode) { - if (arguments.length === 0) { - return options.viewMode; - } - - if (typeof viewMode !== 'string') { - throw new TypeError('viewMode() expects a string parameter'); - } - - if (viewModes.indexOf(viewMode) === -1) { - throw new TypeError('viewMode() parameter must be one of (' + viewModes.join(', ') + ') value'); - } - - options.viewMode = viewMode; - currentViewMode = Math.max(viewModes.indexOf(viewMode), minViewModeNumber); - - showMode(); - return picker; - }; - - picker.toolbarPlacement = function (toolbarPlacement) { - if (arguments.length === 0) { - return options.toolbarPlacement; - } - - if (typeof toolbarPlacement !== 'string') { - throw new TypeError('toolbarPlacement() expects a string parameter'); - } - if (toolbarPlacements.indexOf(toolbarPlacement) === -1) { - throw new TypeError('toolbarPlacement() parameter must be one of (' + toolbarPlacements.join(', ') + ') value'); - } - options.toolbarPlacement = toolbarPlacement; - - if (widget) { - hide(); - show(); - } - return picker; - }; - - picker.widgetPositioning = function (widgetPositioning) { - if (arguments.length === 0) { - return $.extend({}, options.widgetPositioning); - } - - if (({}).toString.call(widgetPositioning) !== '[object Object]') { - throw new TypeError('widgetPositioning() expects an object variable'); - } - if (widgetPositioning.horizontal) { - if (typeof widgetPositioning.horizontal !== 'string') { - throw new TypeError('widgetPositioning() horizontal variable must be a string'); - } - widgetPositioning.horizontal = widgetPositioning.horizontal.toLowerCase(); - if (horizontalModes.indexOf(widgetPositioning.horizontal) === -1) { - throw new TypeError('widgetPositioning() expects horizontal parameter to be one of (' + horizontalModes.join(', ') + ')'); - } - options.widgetPositioning.horizontal = widgetPositioning.horizontal; - } - if (widgetPositioning.vertical) { - if (typeof widgetPositioning.vertical !== 'string') { - throw new TypeError('widgetPositioning() vertical variable must be a string'); - } - widgetPositioning.vertical = widgetPositioning.vertical.toLowerCase(); - if (verticalModes.indexOf(widgetPositioning.vertical) === -1) { - throw new TypeError('widgetPositioning() expects vertical parameter to be one of (' + verticalModes.join(', ') + ')'); - } - options.widgetPositioning.vertical = widgetPositioning.vertical; - } - update(); - return picker; - }; - - picker.calendarWeeks = function (calendarWeeks) { - if (arguments.length === 0) { - return options.calendarWeeks; - } - - if (typeof calendarWeeks !== 'boolean') { - throw new TypeError('calendarWeeks() expects parameter to be a boolean value'); - } - - options.calendarWeeks = calendarWeeks; - update(); - return picker; - }; - - picker.showTodayButton = function (showTodayButton) { - if (arguments.length === 0) { - return options.showTodayButton; - } - - if (typeof showTodayButton !== 'boolean') { - throw new TypeError('showTodayButton() expects a boolean parameter'); - } - - options.showTodayButton = showTodayButton; - if (widget) { - hide(); - show(); - } - return picker; - }; - - picker.showClear = function (showClear) { - if (arguments.length === 0) { - return options.showClear; - } - - if (typeof showClear !== 'boolean') { - throw new TypeError('showClear() expects a boolean parameter'); - } - - options.showClear = showClear; - if (widget) { - hide(); - show(); - } - return picker; - }; - - picker.widgetParent = function (widgetParent) { - if (arguments.length === 0) { - return options.widgetParent; - } - - if (typeof widgetParent === 'string') { - widgetParent = $(widgetParent); - } - - if (widgetParent !== null && (typeof widgetParent !== 'string' && !(widgetParent instanceof $))) { - throw new TypeError('widgetParent() expects a string or a jQuery object parameter'); - } - - options.widgetParent = widgetParent; - if (widget) { - hide(); - show(); - } - return picker; - }; - - picker.keepOpen = function (keepOpen) { - if (arguments.length === 0) { - return options.keepOpen; - } - - if (typeof keepOpen !== 'boolean') { - throw new TypeError('keepOpen() expects a boolean parameter'); - } - - options.keepOpen = keepOpen; - return picker; - }; - - picker.focusOnShow = function (focusOnShow) { - if (arguments.length === 0) { - return options.focusOnShow; - } - - if (typeof focusOnShow !== 'boolean') { - throw new TypeError('focusOnShow() expects a boolean parameter'); - } - - options.focusOnShow = focusOnShow; - return picker; - }; - - picker.inline = function (inline) { - if (arguments.length === 0) { - return options.inline; - } - - if (typeof inline !== 'boolean') { - throw new TypeError('inline() expects a boolean parameter'); - } - - options.inline = inline; - return picker; - }; - - picker.clear = function () { - clear(); - return picker; - }; - - picker.keyBinds = function (keyBinds) { - if (arguments.length === 0) { - return options.keyBinds; - } - - options.keyBinds = keyBinds; - return picker; - }; - - picker.getMoment = function (d) { - return getMoment(d); - }; - - picker.debug = function (debug) { - if (typeof debug !== 'boolean') { - throw new TypeError('debug() expects a boolean parameter'); - } - - options.debug = debug; - return picker; - }; - - picker.allowInputToggle = function (allowInputToggle) { - if (arguments.length === 0) { - return options.allowInputToggle; - } - - if (typeof allowInputToggle !== 'boolean') { - throw new TypeError('allowInputToggle() expects a boolean parameter'); - } - - options.allowInputToggle = allowInputToggle; - return picker; - }; - - picker.showClose = function (showClose) { - if (arguments.length === 0) { - return options.showClose; - } - - if (typeof showClose !== 'boolean') { - throw new TypeError('showClose() expects a boolean parameter'); - } - - options.showClose = showClose; - return picker; - }; - - picker.keepInvalid = function (keepInvalid) { - if (arguments.length === 0) { - return options.keepInvalid; - } - - if (typeof keepInvalid !== 'boolean') { - throw new TypeError('keepInvalid() expects a boolean parameter'); - } - options.keepInvalid = keepInvalid; - return picker; - }; - - picker.datepickerInput = function (datepickerInput) { - if (arguments.length === 0) { - return options.datepickerInput; - } - - if (typeof datepickerInput !== 'string') { - throw new TypeError('datepickerInput() expects a string parameter'); - } - - options.datepickerInput = datepickerInput; - return picker; - }; - - picker.parseInputDate = function (parseInputDate) { - if (arguments.length === 0) { - return options.parseInputDate; - } - - if (typeof parseInputDate !== 'function') { - throw new TypeError('parseInputDate() sholud be as function'); - } - - options.parseInputDate = parseInputDate; - - return picker; - }; - - picker.disabledTimeIntervals = function (disabledTimeIntervals) { - /// - ///Returns an array with the currently set disabled dates on the component. - ///options.disabledTimeIntervals - /// - /// - ///Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of - ///options.enabledDates if such exist. - ///Takes an [ string or Date or moment ] of values and allows the user to select only from those days. - /// - if (arguments.length === 0) { - return (options.disabledTimeIntervals ? $.extend({}, options.disabledTimeIntervals) : options.disabledTimeIntervals); - } - - if (!disabledTimeIntervals) { - options.disabledTimeIntervals = false; - update(); - return picker; - } - if (!(disabledTimeIntervals instanceof Array)) { - throw new TypeError('disabledTimeIntervals() expects an array parameter'); - } - options.disabledTimeIntervals = disabledTimeIntervals; - update(); - return picker; - }; - - picker.disabledHours = function (hours) { - /// - ///Returns an array with the currently set disabled hours on the component. - ///options.disabledHours - /// - /// - ///Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of - ///options.enabledHours if such exist. - ///Takes an [ int ] of values and disallows the user to select only from those hours. - /// - if (arguments.length === 0) { - return (options.disabledHours ? $.extend({}, options.disabledHours) : options.disabledHours); - } - - if (!hours) { - options.disabledHours = false; - update(); - return picker; - } - if (!(hours instanceof Array)) { - throw new TypeError('disabledHours() expects an array parameter'); - } - options.disabledHours = indexGivenHours(hours); - options.enabledHours = false; - if (options.useCurrent && !options.keepInvalid) { - var tries = 0; - while (!isValid(date, 'h')) { - date.add(1, 'h'); - if (tries === 24) { - throw 'Tried 24 times to find a valid date'; - } - tries++; - } - setValue(date); - } - update(); - return picker; - }; - - picker.enabledHours = function (hours) { - /// - ///Returns an array with the currently set enabled hours on the component. - ///options.enabledHours - /// - /// - ///Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of options.disabledHours if such exist. - ///Takes an [ int ] of values and allows the user to select only from those hours. - /// - if (arguments.length === 0) { - return (options.enabledHours ? $.extend({}, options.enabledHours) : options.enabledHours); - } - - if (!hours) { - options.enabledHours = false; - update(); - return picker; - } - if (!(hours instanceof Array)) { - throw new TypeError('enabledHours() expects an array parameter'); - } - options.enabledHours = indexGivenHours(hours); - options.disabledHours = false; - if (options.useCurrent && !options.keepInvalid) { - var tries = 0; - while (!isValid(date, 'h')) { - date.add(1, 'h'); - if (tries === 24) { - throw 'Tried 24 times to find a valid date'; - } - tries++; - } - setValue(date); - } - update(); - return picker; - }; - /** - * Returns the component's model current viewDate, a moment object or null if not set. Passing a null value unsets the components model current moment. Parsing of the newDate parameter is made using moment library with the options.format and options.useStrict components configuration. - * @param {Takes string, viewDate, moment, null parameter.} newDate - * @returns {viewDate.clone()} - */ - picker.viewDate = function (newDate) { - if (arguments.length === 0) { - return viewDate.clone(); - } - - if (!newDate) { - viewDate = date.clone(); - return picker; - } - - if (typeof newDate !== 'string' && !moment.isMoment(newDate) && !(newDate instanceof Date)) { - throw new TypeError('viewDate() parameter must be one of [string, moment or Date]'); - } - - viewDate = parseInputDate(newDate); - viewUpdate(); - return picker; - }; - - // initializing element and component attributes - if (element.is('input')) { - input = element; - } else { - input = element.find(options.datepickerInput); - if (input.length === 0) { - input = element.find('input'); - } else if (!input.is('input')) { - throw new Error('CSS class "' + options.datepickerInput + '" cannot be applied to non input element'); - } - } - - if (element.hasClass('input-group')) { - // in case there is more then one 'input-group-addon' Issue #48 - if (element.find('.datepickerbutton').length === 0) { - component = element.find('.input-group-addon'); - } else { - component = element.find('.datepickerbutton'); - } - } - - if (!options.inline && !input.is('input')) { - throw new Error('Could not initialize DateTimePicker without an input element'); - } - - // Set defaults for date here now instead of in var declaration - date = getMoment(); - viewDate = date.clone(); - - $.extend(true, options, dataToOptions()); - - picker.options(options); - - initFormatting(); - - attachDatePickerElementEvents(); - - if (input.prop('disabled')) { - picker.disable(); + if (dates[language].meridiem.length === 2) { + val.H = (val.h % 12 === 0 ? 12 : val.h % 12); } - if (input.is('input') && input.val().trim().length !== 0) { - setValue(parseInputDate(input.val().trim())); + else { + val.H = val.h; } - else if (options.defaultDate && input.attr('placeholder') === undefined) { - setValue(options.defaultDate); - } - if (options.inline) { - show(); - } - return picker; - }; - - /******************************************************************************** - * - * jQuery plugin constructor and defaults object - * - ********************************************************************************/ - - /** - * See (http://jquery.com/). - * @name jQuery - * @class - * See the jQuery Library (http://jquery.com/) for full details. This just - * documents the function and classes that are added to jQuery by this plug-in. - */ - /** - * See (http://jquery.com/) - * @name fn - * @class - * See the jQuery Library (http://jquery.com/) for full details. This just - * documents the function and classes that are added to jQuery by this plug-in. - * @memberOf jQuery - */ - /** - * Show comments - * @class datetimepicker - * @memberOf jQuery.fn - */ - $.fn.datetimepicker = function (options) { - options = options || {}; - - var args = Array.prototype.slice.call(arguments, 1), - isInstance = true, - thisMethods = ['destroy', 'hide', 'show', 'toggle'], - returnValue; - - if (typeof options === 'object') { - return this.each(function () { - var $this = $(this), - _options; - if (!$this.data('DateTimePicker')) { - // create a private copy of the defaults object - _options = $.extend(true, {}, $.fn.datetimepicker.defaults, options); - $this.data('DateTimePicker', dateTimePicker($this, _options)); - } - }); - } else if (typeof options === 'string') { - this.each(function () { - var $this = $(this), - instance = $this.data('DateTimePicker'); - if (!instance) { - throw new Error('bootstrap-datetimepicker("' + options + '") method was called on an element that is not using DateTimePicker'); - } - - returnValue = instance[options].apply(instance, args); - isInstance = returnValue === instance; - }); - - if (isInstance || $.inArray(options, thisMethods) > -1) { - return this; - } - - return returnValue; + val.HH = (val.H < 10 ? '0' : '') + val.H; + val.P = val.p.toUpperCase(); + val.Z = val.z; + val.hh = (val.h < 10 ? '0' : '') + val.h; + val.ii = (val.i < 10 ? '0' : '') + val.i; + val.ss = (val.s < 10 ? '0' : '') + val.s; + val.dd = (val.d < 10 ? '0' : '') + val.d; + val.mm = (val.m < 10 ? '0' : '') + val.m; + } else if (type === 'php') { + // php format + val = { + // year + y: date.getUTCFullYear().toString().substring(2), + Y: date.getUTCFullYear(), + // month + F: dates[language].months[date.getUTCMonth()], + M: dates[language].monthsShort[date.getUTCMonth()], + n: date.getUTCMonth() + 1, + t: DPGlobal.getDaysInMonth(date.getUTCFullYear(), date.getUTCMonth()), + // day + j: date.getUTCDate(), + l: dates[language].days[date.getUTCDay()], + D: dates[language].daysShort[date.getUTCDay()], + w: date.getUTCDay(), // 0 -> 6 + N: (date.getUTCDay() === 0 ? 7 : date.getUTCDay()), // 1 -> 7 + S: (date.getUTCDate() % 10 <= dates[language].suffix.length ? dates[language].suffix[date.getUTCDate() % 10 - 1] : ''), + // hour + a: (dates[language].meridiem.length === 2 ? dates[language].meridiem[date.getUTCHours() < 12 ? 0 : 1] : ''), + g: (date.getUTCHours() % 12 === 0 ? 12 : date.getUTCHours() % 12), + G: date.getUTCHours(), + // minute + i: date.getUTCMinutes(), + // second + s: date.getUTCSeconds() + }; + val.m = (val.n < 10 ? '0' : '') + val.n; + val.d = (val.j < 10 ? '0' : '') + val.j; + val.A = val.a.toString().toUpperCase(); + val.h = (val.g < 10 ? '0' : '') + val.g; + val.H = (val.G < 10 ? '0' : '') + val.G; + val.i = (val.i < 10 ? '0' : '') + val.i; + val.s = (val.s < 10 ? '0' : '') + val.s; + } else { + throw new Error('Invalid format type.'); + } + var date = [], + seps = $.extend([], format.separators); + for (var i = 0, cnt = format.parts.length; i < cnt; i++) { + if (seps.length) { + date.push(seps.shift()); } + date.push(val[format.parts[i]]); + } + if (seps.length) { + date.push(seps.shift()); + } + return date.join(''); + }, + convertViewMode: function (viewMode) { + switch (viewMode) { + case 4: + case 'decade': + viewMode = 4; + break; + case 3: + case 'year': + viewMode = 3; + break; + case 2: + case 'month': + viewMode = 2; + break; + case 1: + case 'day': + viewMode = 1; + break; + case 0: + case 'hour': + viewMode = 0; + break; + } + + return viewMode; + }, + headTemplate: '' + + '' + + '' + + '' + + '' + + '' + + '', + headTemplateV3: '' + + '' + + '' + + '' + + '' + + '' + + '', + contTemplate: '', + footTemplate: '' + + '' + + '' + + '' + }; + DPGlobal.template = '
' + + '
' + + '
' + dates[this.language].daysMin[(dowCnt++) % 7] + '
' + prevMonth.getUTCDate() + '
').addClass('cw').text('#')); - } - - while (currentDate.isBefore(viewDate.clone().endOf('w'))) { - row.append($('').addClass('dow').text(currentDate.format('dd'))); - currentDate.add(1, 'd'); - } - widget.find('.datepicker-days thead').append(row); - }, - - isInDisabledDates = function (testDate) { - return options.disabledDates[testDate.format('YYYY-MM-DD')] === true; - }, - - isInEnabledDates = function (testDate) { - return options.enabledDates[testDate.format('YYYY-MM-DD')] === true; - }, - - isInDisabledHours = function (testDate) { - return options.disabledHours[testDate.format('H')] === true; - }, - - isInEnabledHours = function (testDate) { - return options.enabledHours[testDate.format('H')] === true; - }, - - isValid = function (targetMoment, granularity) { - if (!targetMoment.isValid()) { - return false; - } - if (options.disabledDates && granularity === 'd' && isInDisabledDates(targetMoment)) { - return false; - } - if (options.enabledDates && granularity === 'd' && !isInEnabledDates(targetMoment)) { - return false; - } - if (options.minDate && targetMoment.isBefore(options.minDate, granularity)) { - return false; - } - if (options.maxDate && targetMoment.isAfter(options.maxDate, granularity)) { - return false; - } - if (options.daysOfWeekDisabled && granularity === 'd' && options.daysOfWeekDisabled.indexOf(targetMoment.day()) !== -1) { - return false; - } - if (options.disabledHours && (granularity === 'h' || granularity === 'm' || granularity === 's') && isInDisabledHours(targetMoment)) { - return false; - } - if (options.enabledHours && (granularity === 'h' || granularity === 'm' || granularity === 's') && !isInEnabledHours(targetMoment)) { - return false; - } - if (options.disabledTimeIntervals && (granularity === 'h' || granularity === 'm' || granularity === 's')) { - var found = false; - $.each(options.disabledTimeIntervals, function () { - if (targetMoment.isBetween(this[0], this[1])) { - found = true; - return false; - } - }); - if (found) { - return false; - } - } - return true; - }, - - fillMonths = function () { - var spans = [], - monthsShort = viewDate.clone().startOf('y').startOf('d'); - while (monthsShort.isSame(viewDate, 'y')) { - spans.push($('').attr('data-action', 'selectMonth').addClass('month').text(monthsShort.format('MMM'))); - monthsShort.add(1, 'M'); - } - widget.find('.datepicker-months td').empty().append(spans); - }, - - updateMonths = function () { - var monthsView = widget.find('.datepicker-months'), - monthsViewHeader = monthsView.find('th'), - months = monthsView.find('tbody').find('span'); - - monthsViewHeader.eq(0).find('span').attr('title', options.tooltips.prevYear); - monthsViewHeader.eq(1).attr('title', options.tooltips.selectYear); - monthsViewHeader.eq(2).find('span').attr('title', options.tooltips.nextYear); - - monthsView.find('.disabled').removeClass('disabled'); - - if (!isValid(viewDate.clone().subtract(1, 'y'), 'y')) { - monthsViewHeader.eq(0).addClass('disabled'); - } - - monthsViewHeader.eq(1).text(viewDate.year()); - - if (!isValid(viewDate.clone().add(1, 'y'), 'y')) { - monthsViewHeader.eq(2).addClass('disabled'); - } - - months.removeClass('active'); - if (date.isSame(viewDate, 'y') && !unset) { - months.eq(date.month()).addClass('active'); - } - - months.each(function (index) { - if (!isValid(viewDate.clone().month(index), 'M')) { - $(this).addClass('disabled'); - } + if (this.viewSelect >= 3) { + this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0)); + } + } else if (target.is('.year')) { + this.viewDate.setUTCDate(1); + year = parseInt(target.text(), 10) || 0; + this.viewDate.setUTCFullYear(year); + this.element.trigger({ + type: 'changeYear', + date: this.viewDate }); - }, - - updateYears = function () { - var yearsView = widget.find('.datepicker-years'), - yearsViewHeader = yearsView.find('th'), - startYear = viewDate.clone().subtract(5, 'y'), - endYear = viewDate.clone().add(6, 'y'), - html = ''; - - yearsViewHeader.eq(0).find('span').attr('title', options.tooltips.prevDecade); - yearsViewHeader.eq(1).attr('title', options.tooltips.selectDecade); - yearsViewHeader.eq(2).find('span').attr('title', options.tooltips.nextDecade); - - yearsView.find('.disabled').removeClass('disabled'); - - if (options.minDate && options.minDate.isAfter(startYear, 'y')) { - yearsViewHeader.eq(0).addClass('disabled'); - } - - yearsViewHeader.eq(1).text(startYear.year() + '-' + endYear.year()); - - if (options.maxDate && options.maxDate.isBefore(endYear, 'y')) { - yearsViewHeader.eq(2).addClass('disabled'); - } - - while (!startYear.isAfter(endYear, 'y')) { - html += '' + startYear.year() + ''; - startYear.add(1, 'y'); - } - - yearsView.find('td').html(html); - }, - - updateDecades = function () { - var decadesView = widget.find('.datepicker-decades'), - decadesViewHeader = decadesView.find('th'), - startDecade = moment({ y: viewDate.year() - (viewDate.year() % 100) - 1 }), - endDecade = startDecade.clone().add(100, 'y'), - startedAt = startDecade.clone(), - minDateDecade = false, - maxDateDecade = false, - endDecadeYear, - html = ''; - - decadesViewHeader.eq(0).find('span').attr('title', options.tooltips.prevCentury); - decadesViewHeader.eq(2).find('span').attr('title', options.tooltips.nextCentury); - - decadesView.find('.disabled').removeClass('disabled'); - - if (startDecade.isSame(moment({ y: 1900 })) || (options.minDate && options.minDate.isAfter(startDecade, 'y'))) { - decadesViewHeader.eq(0).addClass('disabled'); - } - - decadesViewHeader.eq(1).text(startDecade.year() + '-' + endDecade.year()); - - if (startDecade.isSame(moment({ y: 2000 })) || (options.maxDate && options.maxDate.isBefore(endDecade, 'y'))) { - decadesViewHeader.eq(2).addClass('disabled'); - } - - while (!startDecade.isAfter(endDecade, 'y')) { - endDecadeYear = startDecade.year() + 12; - minDateDecade = options.minDate && options.minDate.isAfter(startDecade, 'y') && options.minDate.year() <= endDecadeYear; - maxDateDecade = options.maxDate && options.maxDate.isAfter(startDecade, 'y') && options.maxDate.year() <= endDecadeYear; - html += '' + (startDecade.year() + 1) + ' - ' + (startDecade.year() + 12) + ''; - startDecade.add(12, 'y'); - } - html += ''; //push the dangling block over, at least this way it's even - - decadesView.find('td').html(html); - decadesViewHeader.eq(1).text((startedAt.year() + 1) + '-' + (startDecade.year())); - }, - - fillDate = function () { - var daysView = widget.find('.datepicker-days'), - daysViewHeader = daysView.find('th'), - currentDate, - html = [], - row, - clsNames = [], - i; - - if (!hasDate()) { - return; - } - - daysViewHeader.eq(0).find('span').attr('title', options.tooltips.prevMonth); - daysViewHeader.eq(1).attr('title', options.tooltips.selectMonth); - daysViewHeader.eq(2).find('span').attr('title', options.tooltips.nextMonth); - - daysView.find('.disabled').removeClass('disabled'); - daysViewHeader.eq(1).text(viewDate.format(options.dayViewHeaderFormat)); - - if (!isValid(viewDate.clone().subtract(1, 'M'), 'M')) { - daysViewHeader.eq(0).addClass('disabled'); - } - if (!isValid(viewDate.clone().add(1, 'M'), 'M')) { - daysViewHeader.eq(2).addClass('disabled'); - } - - currentDate = viewDate.clone().startOf('M').startOf('w').startOf('d'); - - for (i = 0; i < 42; i++) { //always display 42 days (should show 6 weeks) - if (currentDate.weekday() === 0) { - row = $('
' + currentDate.week() + '' + currentDate.date() + '
' + currentHour.format(use24Hours ? 'HH' : 'hh') + '
' + currentMinute.format('mm') + '
' + currentSecond.format('ss') + '
' + + DPGlobal.headTemplate + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '' + + '
' + + '' + + DPGlobal.headTemplate + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplate + + '' + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplate + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplate + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + ''; + DPGlobal.templateV3 = '
' + + '
' + + '' + + DPGlobal.headTemplateV3 + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplateV3 + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplateV3 + + '' + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplateV3 + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplateV3 + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
'; + $.fn.datetimepicker.DPGlobal = DPGlobal; + + /* DATETIMEPICKER NO CONFLICT + * =================== */ + + $.fn.datetimepicker.noConflict = function () { + $.fn.datetimepicker = old; + return this; + }; + + /* DATETIMEPICKER DATA-API + * ================== */ + + $(document).on( + 'focus.datetimepicker.data-api click.datetimepicker.data-api', + '[data-provide="datetimepicker"]', + function (e) { + var $this = $(this); + if ($this.data('datetimepicker')) return; + e.preventDefault(); + // component click requires us to explicitly show it + $this.datetimepicker('show'); + } + ); + $(function () { + $('[data-provide="datetimepicker-inline"]').datetimepicker(); + }); - throw new TypeError('Invalid arguments for DateTimePicker: ' + options); - }; - - $.fn.datetimepicker.defaults = { - timeZone: '', - format: false, - dayViewHeaderFormat: 'MMMM YYYY', - extraFormats: false, - stepping: 1, - minDate: false, - maxDate: false, - useCurrent: true, - collapse: true, - locale: moment.locale(), - defaultDate: false, - disabledDates: false, - enabledDates: false, - icons: { - time: 'glyphicon glyphicon-time', - date: 'glyphicon glyphicon-calendar', - up: 'glyphicon glyphicon-chevron-up', - down: 'glyphicon glyphicon-chevron-down', - previous: 'glyphicon glyphicon-chevron-left', - next: 'glyphicon glyphicon-chevron-right', - today: 'glyphicon glyphicon-screenshot', - clear: 'glyphicon glyphicon-trash', - close: 'glyphicon glyphicon-remove' - }, - tooltips: { - today: 'Go to today', - clear: 'Clear selection', - close: 'Close the picker', - selectMonth: 'Select Month', - prevMonth: 'Previous Month', - nextMonth: 'Next Month', - selectYear: 'Select Year', - prevYear: 'Previous Year', - nextYear: 'Next Year', - selectDecade: 'Select Decade', - prevDecade: 'Previous Decade', - nextDecade: 'Next Decade', - prevCentury: 'Previous Century', - nextCentury: 'Next Century', - pickHour: 'Pick Hour', - incrementHour: 'Increment Hour', - decrementHour: 'Decrement Hour', - pickMinute: 'Pick Minute', - incrementMinute: 'Increment Minute', - decrementMinute: 'Decrement Minute', - pickSecond: 'Pick Second', - incrementSecond: 'Increment Second', - decrementSecond: 'Decrement Second', - togglePeriod: 'Toggle Period', - selectTime: 'Select Time' - }, - useStrict: false, - sideBySide: false, - daysOfWeekDisabled: false, - calendarWeeks: false, - viewMode: 'days', - toolbarPlacement: 'default', - showTodayButton: false, - showClear: false, - showClose: false, - widgetPositioning: { - horizontal: 'auto', - vertical: 'auto' - }, - widgetParent: null, - ignoreReadonly: false, - keepOpen: false, - focusOnShow: true, - inline: false, - keepInvalid: false, - datepickerInput: '.datepickerinput', - keyBinds: { - up: function (widget) { - if (!widget) { - return; - } - var d = this.date() || this.getMoment(); - if (widget.find('.datepicker').is(':visible')) { - this.date(d.clone().subtract(7, 'd')); - } else { - this.date(d.clone().add(this.stepping(), 'm')); - } - }, - down: function (widget) { - if (!widget) { - this.show(); - return; - } - var d = this.date() || this.getMoment(); - if (widget.find('.datepicker').is(':visible')) { - this.date(d.clone().add(7, 'd')); - } else { - this.date(d.clone().subtract(this.stepping(), 'm')); - } - }, - 'control up': function (widget) { - if (!widget) { - return; - } - var d = this.date() || this.getMoment(); - if (widget.find('.datepicker').is(':visible')) { - this.date(d.clone().subtract(1, 'y')); - } else { - this.date(d.clone().add(1, 'h')); - } - }, - 'control down': function (widget) { - if (!widget) { - return; - } - var d = this.date() || this.getMoment(); - if (widget.find('.datepicker').is(':visible')) { - this.date(d.clone().add(1, 'y')); - } else { - this.date(d.clone().subtract(1, 'h')); - } - }, - left: function (widget) { - if (!widget) { - return; - } - var d = this.date() || this.getMoment(); - if (widget.find('.datepicker').is(':visible')) { - this.date(d.clone().subtract(1, 'd')); - } - }, - right: function (widget) { - if (!widget) { - return; - } - var d = this.date() || this.getMoment(); - if (widget.find('.datepicker').is(':visible')) { - this.date(d.clone().add(1, 'd')); - } - }, - pageUp: function (widget) { - if (!widget) { - return; - } - var d = this.date() || this.getMoment(); - if (widget.find('.datepicker').is(':visible')) { - this.date(d.clone().subtract(1, 'M')); - } - }, - pageDown: function (widget) { - if (!widget) { - return; - } - var d = this.date() || this.getMoment(); - if (widget.find('.datepicker').is(':visible')) { - this.date(d.clone().add(1, 'M')); - } - }, - enter: function () { - this.hide(); - }, - escape: function () { - this.hide(); - }, - //tab: function (widget) { //this break the flow of the form. disabling for now - // var toggle = widget.find('.picker-switch a[data-action="togglePicker"]'); - // if(toggle.length > 0) toggle.click(); - //}, - 'control space': function (widget) { - if (!widget) { - return; - } - if (widget.find('.timepicker').is(':visible')) { - widget.find('.btn[data-action="togglePeriod"]').click(); - } - }, - t: function () { - this.date(this.getMoment()); - }, - 'delete': function () { - this.clear(); - } - }, - debug: false, - allowInputToggle: false, - disabledTimeIntervals: false, - disabledHours: false, - enabledHours: false, - viewDate: false - }; - - return $.fn.datetimepicker; })); diff --git a/app/assets/javascripts/cooperative/laboratory_users/index.js b/app/assets/javascripts/cooperative/laboratory_users/index.js index cd705d8d0..19385f003 100644 --- a/app/assets/javascripts/cooperative/laboratory_users/index.js +++ b/app/assets/javascripts/cooperative/laboratory_users/index.js @@ -27,7 +27,7 @@ $(document).on('turbolinks:load', function() { }, templateResult: function (item) { if(!item.id || item.id === '') return item.text; - return item.real_name + "--" + item.identity; + return $("" + item.real_name + " " + item.school_name + ' ' + item.hidden_phone + ""); }, templateSelection: function(item){ if (item.id) { diff --git a/app/assets/javascripts/i18n/bootstrap-datetimepicker.zh-CN.js b/app/assets/javascripts/i18n/bootstrap-datetimepicker.zh-CN.js new file mode 100755 index 000000000..418fb3071 --- /dev/null +++ b/app/assets/javascripts/i18n/bootstrap-datetimepicker.zh-CN.js @@ -0,0 +1,16 @@ +/** + * Simplified Chinese translation for bootstrap-datetimepicker + * Yuan Cheung + */ +;(function($){ + $.fn.datetimepicker.dates['zh-CN'] = { + days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"], + daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"], + daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"], + months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], + monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], + today: "今天", + suffix: [], + meridiem: ["上午", "下午"] + }; +}(jQuery)); diff --git a/app/assets/javascripts/moment.min.js b/app/assets/javascripts/moment.min.js new file mode 100644 index 000000000..451e445c2 --- /dev/null +++ b/app/assets/javascripts/moment.min.js @@ -0,0 +1,7 @@ +//! moment.js +//! version : 2.10.6 +//! authors : Tim Wood, Iskren Chernev, Moment.js contributors +//! license : MIT +//! momentjs.com +!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return Hc.apply(null,arguments)}function b(a){Hc=a}function c(a){return"[object Array]"===Object.prototype.toString.call(a)}function d(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function e(a,b){var c,d=[];for(c=0;c0)for(c in Jc)d=Jc[c],e=b[d],"undefined"!=typeof e&&(a[d]=e);return a}function n(b){m(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),Kc===!1&&(Kc=!0,a.updateOffset(this),Kc=!1)}function o(a){return a instanceof n||null!=a&&null!=a._isAMomentObject}function p(a){return 0>a?Math.ceil(a):Math.floor(a)}function q(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=p(b)),c}function r(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&q(a[d])!==q(b[d]))&&g++;return g+f}function s(){}function t(a){return a?a.toLowerCase().replace("_","-"):a}function u(a){for(var b,c,d,e,f=0;f0;){if(d=v(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&r(e,c,!0)>=b-1)break;b--}f++}return null}function v(a){var b=null;if(!Lc[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=Ic._abbr,require("./locale/"+a),w(b)}catch(c){}return Lc[a]}function w(a,b){var c;return a&&(c="undefined"==typeof b?y(a):x(a,b),c&&(Ic=c)),Ic._abbr}function x(a,b){return null!==b?(b.abbr=a,Lc[a]=Lc[a]||new s,Lc[a].set(b),w(a),Lc[a]):(delete Lc[a],null)}function y(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return Ic;if(!c(a)){if(b=v(a))return b;a=[a]}return u(a)}function z(a,b){var c=a.toLowerCase();Mc[c]=Mc[c+"s"]=Mc[b]=a}function A(a){return"string"==typeof a?Mc[a]||Mc[a.toLowerCase()]:void 0}function B(a){var b,c,d={};for(c in a)f(a,c)&&(b=A(c),b&&(d[b]=a[c]));return d}function C(b,c){return function(d){return null!=d?(E(this,b,d),a.updateOffset(this,c),this):D(this,b)}}function D(a,b){return a._d["get"+(a._isUTC?"UTC":"")+b]()}function E(a,b,c){return a._d["set"+(a._isUTC?"UTC":"")+b](c)}function F(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else if(a=A(a),"function"==typeof this[a])return this[a](b);return this}function G(a,b,c){var d=""+Math.abs(a),e=b-d.length,f=a>=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}function H(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(Qc[a]=e),b&&(Qc[b[0]]=function(){return G(e.apply(this,arguments),b[1],b[2])}),c&&(Qc[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function I(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function J(a){var b,c,d=a.match(Nc);for(b=0,c=d.length;c>b;b++)Qc[d[b]]?d[b]=Qc[d[b]]:d[b]=I(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function K(a,b){return a.isValid()?(b=L(b,a.localeData()),Pc[b]=Pc[b]||J(b),Pc[b](a)):a.localeData().invalidDate()}function L(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Oc.lastIndex=0;d>=0&&Oc.test(a);)a=a.replace(Oc,c),Oc.lastIndex=0,d-=1;return a}function M(a){return"function"==typeof a&&"[object Function]"===Object.prototype.toString.call(a)}function N(a,b,c){dd[a]=M(b)?b:function(a){return a&&c?c:b}}function O(a,b){return f(dd,a)?dd[a](b._strict,b._locale):new RegExp(P(a))}function P(a){return a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Q(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),"number"==typeof b&&(d=function(a,c){c[b]=q(a)}),c=0;cd;d++){if(e=h([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function X(a,b){var c;return"string"==typeof b&&(b=a.localeData().monthsParse(b),"number"!=typeof b)?a:(c=Math.min(a.date(),T(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a)}function Y(b){return null!=b?(X(this,b),a.updateOffset(this,!0),this):D(this,"Month")}function Z(){return T(this.year(),this.month())}function $(a){var b,c=a._a;return c&&-2===j(a).overflow&&(b=c[gd]<0||c[gd]>11?gd:c[hd]<1||c[hd]>T(c[fd],c[gd])?hd:c[id]<0||c[id]>24||24===c[id]&&(0!==c[jd]||0!==c[kd]||0!==c[ld])?id:c[jd]<0||c[jd]>59?jd:c[kd]<0||c[kd]>59?kd:c[ld]<0||c[ld]>999?ld:-1,j(a)._overflowDayOfYear&&(fd>b||b>hd)&&(b=hd),j(a).overflow=b),a}function _(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function aa(a,b){var c=!0;return g(function(){return c&&(_(a+"\n"+(new Error).stack),c=!1),b.apply(this,arguments)},b)}function ba(a,b){od[a]||(_(b),od[a]=!0)}function ca(a){var b,c,d=a._i,e=pd.exec(d);if(e){for(j(a).iso=!0,b=0,c=qd.length;c>b;b++)if(qd[b][1].exec(d)){a._f=qd[b][0];break}for(b=0,c=rd.length;c>b;b++)if(rd[b][1].exec(d)){a._f+=(e[6]||" ")+rd[b][0];break}d.match(ad)&&(a._f+="Z"),va(a)}else a._isValid=!1}function da(b){var c=sd.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(ca(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}function ea(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function fa(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function ga(a){return ha(a)?366:365}function ha(a){return a%4===0&&a%100!==0||a%400===0}function ia(){return ha(this.year())}function ja(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=Da(a).add(f,"d"),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function ka(a){return ja(a,this._week.dow,this._week.doy).week}function la(){return this._week.dow}function ma(){return this._week.doy}function na(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function oa(a){var b=ja(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function pa(a,b,c,d,e){var f,g=6+e-d,h=fa(a,0,1+g),i=h.getUTCDay();return e>i&&(i+=7),c=null!=c?1*c:e,f=1+g+7*(b-1)-i+c,{year:f>0?a:a-1,dayOfYear:f>0?f:ga(a-1)+f}}function qa(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function ra(a,b,c){return null!=a?a:null!=b?b:c}function sa(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function ta(a){var b,c,d,e,f=[];if(!a._d){for(d=sa(a),a._w&&null==a._a[hd]&&null==a._a[gd]&&ua(a),a._dayOfYear&&(e=ra(a._a[fd],d[fd]),a._dayOfYear>ga(e)&&(j(a)._overflowDayOfYear=!0),c=fa(e,0,a._dayOfYear),a._a[gd]=c.getUTCMonth(),a._a[hd]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[id]&&0===a._a[jd]&&0===a._a[kd]&&0===a._a[ld]&&(a._nextDay=!0,a._a[id]=0),a._d=(a._useUTC?fa:ea).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[id]=24)}}function ua(a){var b,c,d,e,f,g,h;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=ra(b.GG,a._a[fd],ja(Da(),1,4).year),d=ra(b.W,1),e=ra(b.E,1)):(f=a._locale._week.dow,g=a._locale._week.doy,c=ra(b.gg,a._a[fd],ja(Da(),f,g).year),d=ra(b.w,1),null!=b.d?(e=b.d,f>e&&++d):e=null!=b.e?b.e+f:f),h=pa(c,d,e,g,f),a._a[fd]=h.year,a._dayOfYear=h.dayOfYear}function va(b){if(b._f===a.ISO_8601)return void ca(b);b._a=[],j(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,k=0;for(e=L(b._f,b._locale).match(Nc)||[],c=0;c0&&j(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),k+=d.length),Qc[f]?(d?j(b).empty=!1:j(b).unusedTokens.push(f),S(f,d,b)):b._strict&&!d&&j(b).unusedTokens.push(f);j(b).charsLeftOver=i-k,h.length>0&&j(b).unusedInput.push(h),j(b).bigHour===!0&&b._a[id]<=12&&b._a[id]>0&&(j(b).bigHour=void 0),b._a[id]=wa(b._locale,b._a[id],b._meridiem),ta(b),$(b)}function wa(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function xa(a){var b,c,d,e,f;if(0===a._f.length)return j(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;ef)&&(d=f,c=b));g(a,c||b)}function ya(a){if(!a._d){var b=B(a._i);a._a=[b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],ta(a)}}function za(a){var b=new n($(Aa(a)));return b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b}function Aa(a){var b=a._i,e=a._f;return a._locale=a._locale||y(a._l),null===b||void 0===e&&""===b?l({nullInput:!0}):("string"==typeof b&&(a._i=b=a._locale.preparse(b)),o(b)?new n($(b)):(c(e)?xa(a):e?va(a):d(b)?a._d=b:Ba(a),a))}function Ba(b){var f=b._i;void 0===f?b._d=new Date:d(f)?b._d=new Date(+f):"string"==typeof f?da(b):c(f)?(b._a=e(f.slice(0),function(a){return parseInt(a,10)}),ta(b)):"object"==typeof f?ya(b):"number"==typeof f?b._d=new Date(f):a.createFromInputFallback(b)}function Ca(a,b,c,d,e){var f={};return"boolean"==typeof c&&(d=c,c=void 0),f._isAMomentObject=!0,f._useUTC=f._isUTC=e,f._l=c,f._i=a,f._f=b,f._strict=d,za(f)}function Da(a,b,c,d){return Ca(a,b,c,d,!1)}function Ea(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return Da();for(d=b[0],e=1;ea&&(a=-a,c="-"),c+G(~~(a/60),2)+b+G(~~a%60,2)})}function Ka(a){var b=(a||"").match(ad)||[],c=b[b.length-1]||[],d=(c+"").match(xd)||["-",0,0],e=+(60*d[1])+q(d[2]);return"+"===d[0]?e:-e}function La(b,c){var e,f;return c._isUTC?(e=c.clone(),f=(o(b)||d(b)?+b:+Da(b))-+e,e._d.setTime(+e._d+f),a.updateOffset(e,!1),e):Da(b).local()}function Ma(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Na(b,c){var d,e=this._offset||0;return null!=b?("string"==typeof b&&(b=Ka(b)),Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Ma(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?bb(this,Ya(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Ma(this)}function Oa(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Pa(a){return this.utcOffset(0,a)}function Qa(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Ma(this),"m")),this}function Ra(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ka(this._i)),this}function Sa(a){return a=a?Da(a).utcOffset():0,(this.utcOffset()-a)%60===0}function Ta(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ua(){if("undefined"!=typeof this._isDSTShifted)return this._isDSTShifted;var a={};if(m(a,this),a=Aa(a),a._a){var b=a._isUTC?h(a._a):Da(a._a);this._isDSTShifted=this.isValid()&&r(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Va(){return!this._isUTC}function Wa(){return this._isUTC}function Xa(){return this._isUTC&&0===this._offset}function Ya(a,b){var c,d,e,g=a,h=null;return Ia(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(g={},b?g[b]=a:g.milliseconds=a):(h=yd.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:q(h[hd])*c,h:q(h[id])*c,m:q(h[jd])*c,s:q(h[kd])*c,ms:q(h[ld])*c}):(h=zd.exec(a))?(c="-"===h[1]?-1:1,g={y:Za(h[2],c),M:Za(h[3],c),d:Za(h[4],c),h:Za(h[5],c),m:Za(h[6],c),s:Za(h[7],c),w:Za(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=_a(Da(g.from),Da(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new Ha(g),Ia(a)&&f(a,"_locale")&&(d._locale=a._locale),d}function Za(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function $a(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function _a(a,b){var c;return b=La(b,a),a.isBefore(b)?c=$a(a,b):(c=$a(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c}function ab(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(ba(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Ya(c,d),bb(this,e,a),this}}function bb(b,c,d,e){var f=c._milliseconds,g=c._days,h=c._months;e=null==e?!0:e,f&&b._d.setTime(+b._d+f*d),g&&E(b,"Date",D(b,"Date")+g*d),h&&X(b,D(b,"Month")+h*d),e&&a.updateOffset(b,g||h)}function cb(a,b){var c=a||Da(),d=La(c,this).startOf("day"),e=this.diff(d,"days",!0),f=-6>e?"sameElse":-1>e?"lastWeek":0>e?"lastDay":1>e?"sameDay":2>e?"nextDay":7>e?"nextWeek":"sameElse";return this.format(b&&b[f]||this.localeData().calendar(f,this,Da(c)))}function db(){return new n(this)}function eb(a,b){var c;return b=A("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=o(a)?a:Da(a),+this>+a):(c=o(a)?+a:+Da(a),c<+this.clone().startOf(b))}function fb(a,b){var c;return b=A("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=o(a)?a:Da(a),+a>+this):(c=o(a)?+a:+Da(a),+this.clone().endOf(b)b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)}function kb(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function lb(){var a=this.clone().utc();return 0b;b++)if(this._weekdaysParse[b]||(c=Da([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b}function Pb(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Kb(a,this.localeData()),this.add(a-b,"d")):b}function Qb(a){var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function Rb(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)}function Sb(a,b){H(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function Tb(a,b){return b._meridiemParse}function Ub(a){return"p"===(a+"").toLowerCase().charAt(0)}function Vb(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Wb(a,b){b[ld]=q(1e3*("0."+a))}function Xb(){return this._isUTC?"UTC":""}function Yb(){return this._isUTC?"Coordinated Universal Time":""}function Zb(a){return Da(1e3*a)}function $b(){return Da.apply(null,arguments).parseZone()}function _b(a,b,c){var d=this._calendar[a];return"function"==typeof d?d.call(b,c):d}function ac(a){var b=this._longDateFormat[a],c=this._longDateFormat[a.toUpperCase()];return b||!c?b:(this._longDateFormat[a]=c.replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a])}function bc(){return this._invalidDate}function cc(a){return this._ordinal.replace("%d",a)}function dc(a){return a}function ec(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)}function fc(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)}function gc(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function hc(a,b,c,d){var e=y(),f=h().set(d,b);return e[c](f,a)}function ic(a,b,c,d,e){if("number"==typeof a&&(b=a,a=void 0),a=a||"",null!=b)return hc(a,b,c,e);var f,g=[];for(f=0;d>f;f++)g[f]=hc(a,f,c,e);return g}function jc(a,b){return ic(a,b,"months",12,"month")}function kc(a,b){return ic(a,b,"monthsShort",12,"month")}function lc(a,b){return ic(a,b,"weekdays",7,"day")}function mc(a,b){return ic(a,b,"weekdaysShort",7,"day")}function nc(a,b){return ic(a,b,"weekdaysMin",7,"day")}function oc(){var a=this._data;return this._milliseconds=Wd(this._milliseconds),this._days=Wd(this._days),this._months=Wd(this._months),a.milliseconds=Wd(a.milliseconds),a.seconds=Wd(a.seconds),a.minutes=Wd(a.minutes),a.hours=Wd(a.hours),a.months=Wd(a.months),a.years=Wd(a.years),this}function pc(a,b,c,d){var e=Ya(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function qc(a,b){return pc(this,a,b,1)}function rc(a,b){return pc(this,a,b,-1)}function sc(a){return 0>a?Math.floor(a):Math.ceil(a)}function tc(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;return f>=0&&g>=0&&h>=0||0>=f&&0>=g&&0>=h||(f+=864e5*sc(vc(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=p(f/1e3),i.seconds=a%60,b=p(a/60),i.minutes=b%60,c=p(b/60),i.hours=c%24,g+=p(c/24),e=p(uc(g)),h+=e,g-=sc(vc(e)),d=p(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function uc(a){return 4800*a/146097}function vc(a){return 146097*a/4800}function wc(a){var b,c,d=this._milliseconds;if(a=A(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+uc(b),"month"===a?c:c/12;switch(b=this._days+Math.round(vc(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function xc(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*q(this._months/12)}function yc(a){return function(){return this.as(a)}}function zc(a){return a=A(a),this[a+"s"]()}function Ac(a){return function(){return this._data[a]}}function Bc(){return p(this.days()/7)}function Cc(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function Dc(a,b,c){var d=Ya(a).abs(),e=ke(d.as("s")),f=ke(d.as("m")),g=ke(d.as("h")),h=ke(d.as("d")),i=ke(d.as("M")),j=ke(d.as("y")),k=e0,k[4]=c,Cc.apply(null,k)}function Ec(a,b){return void 0===le[a]?!1:void 0===b?le[a]:(le[a]=b,!0)}function Fc(a){var b=this.localeData(),c=Dc(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function Gc(){var a,b,c,d=me(this._milliseconds)/1e3,e=me(this._days),f=me(this._months);a=p(d/60),b=p(a/60),d%=60,a%=60,c=p(f/12),f%=12;var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(0>m?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}var Hc,Ic,Jc=a.momentProperties=[],Kc=!1,Lc={},Mc={},Nc=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Oc=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Pc={},Qc={},Rc=/\d/,Sc=/\d\d/,Tc=/\d{3}/,Uc=/\d{4}/,Vc=/[+-]?\d{6}/,Wc=/\d\d?/,Xc=/\d{1,3}/,Yc=/\d{1,4}/,Zc=/[+-]?\d{1,6}/,$c=/\d+/,_c=/[+-]?\d+/,ad=/Z|[+-]\d\d:?\d\d/gi,bd=/[+-]?\d+(\.\d{1,3})?/,cd=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,dd={},ed={},fd=0,gd=1,hd=2,id=3,jd=4,kd=5,ld=6;H("M",["MM",2],"Mo",function(){return this.month()+1}),H("MMM",0,0,function(a){return this.localeData().monthsShort(this,a)}),H("MMMM",0,0,function(a){return this.localeData().months(this,a)}),z("month","M"),N("M",Wc),N("MM",Wc,Sc),N("MMM",cd),N("MMMM",cd),Q(["M","MM"],function(a,b){b[gd]=q(a)-1}),Q(["MMM","MMMM"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict);null!=e?b[gd]=e:j(c).invalidMonth=a});var md="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),nd="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),od={};a.suppressDeprecationWarnings=!1;var pd=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,qd=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],rd=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],sd=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=aa("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),H(0,["YY",2],0,function(){return this.year()%100}),H(0,["YYYY",4],0,"year"),H(0,["YYYYY",5],0,"year"),H(0,["YYYYYY",6,!0],0,"year"),z("year","y"),N("Y",_c),N("YY",Wc,Sc),N("YYYY",Yc,Uc),N("YYYYY",Zc,Vc),N("YYYYYY",Zc,Vc),Q(["YYYYY","YYYYYY"],fd),Q("YYYY",function(b,c){c[fd]=2===b.length?a.parseTwoDigitYear(b):q(b)}),Q("YY",function(b,c){c[fd]=a.parseTwoDigitYear(b)}),a.parseTwoDigitYear=function(a){return q(a)+(q(a)>68?1900:2e3)};var td=C("FullYear",!1);H("w",["ww",2],"wo","week"),H("W",["WW",2],"Wo","isoWeek"),z("week","w"),z("isoWeek","W"),N("w",Wc),N("ww",Wc,Sc),N("W",Wc),N("WW",Wc,Sc),R(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=q(a)});var ud={dow:0,doy:6};H("DDD",["DDDD",3],"DDDo","dayOfYear"),z("dayOfYear","DDD"),N("DDD",Xc),N("DDDD",Tc),Q(["DDD","DDDD"],function(a,b,c){c._dayOfYear=q(a)}),a.ISO_8601=function(){};var vd=aa("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var a=Da.apply(null,arguments);return this>a?this:a}),wd=aa("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var a=Da.apply(null,arguments);return a>this?this:a});Ja("Z",":"),Ja("ZZ",""),N("Z",ad),N("ZZ",ad),Q(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ka(a)});var xd=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var yd=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,zd=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;Ya.fn=Ha.prototype;var Ad=ab(1,"add"),Bd=ab(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var Cd=aa("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});H(0,["gg",2],0,function(){return this.weekYear()%100}),H(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Db("gggg","weekYear"),Db("ggggg","weekYear"),Db("GGGG","isoWeekYear"),Db("GGGGG","isoWeekYear"),z("weekYear","gg"),z("isoWeekYear","GG"),N("G",_c),N("g",_c),N("GG",Wc,Sc),N("gg",Wc,Sc),N("GGGG",Yc,Uc),N("gggg",Yc,Uc),N("GGGGG",Zc,Vc),N("ggggg",Zc,Vc),R(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=q(a)}),R(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),H("Q",0,0,"quarter"),z("quarter","Q"),N("Q",Rc),Q("Q",function(a,b){b[gd]=3*(q(a)-1)}),H("D",["DD",2],"Do","date"),z("date","D"),N("D",Wc),N("DD",Wc,Sc),N("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),Q(["D","DD"],hd),Q("Do",function(a,b){b[hd]=q(a.match(Wc)[0],10)});var Dd=C("Date",!0);H("d",0,"do","day"),H("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),H("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),H("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),H("e",0,0,"weekday"),H("E",0,0,"isoWeekday"),z("day","d"),z("weekday","e"),z("isoWeekday","E"),N("d",Wc),N("e",Wc),N("E",Wc),N("dd",cd),N("ddd",cd),N("dddd",cd),R(["dd","ddd","dddd"],function(a,b,c){var d=c._locale.weekdaysParse(a);null!=d?b.d=d:j(c).invalidWeekday=a}),R(["d","e","E"],function(a,b,c,d){b[d]=q(a)});var Ed="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Fd="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Gd="Su_Mo_Tu_We_Th_Fr_Sa".split("_");H("H",["HH",2],0,"hour"),H("h",["hh",2],0,function(){return this.hours()%12||12}),Sb("a",!0),Sb("A",!1),z("hour","h"),N("a",Tb),N("A",Tb),N("H",Wc),N("h",Wc),N("HH",Wc,Sc),N("hh",Wc,Sc),Q(["H","HH"],id),Q(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),Q(["h","hh"],function(a,b,c){b[id]=q(a),j(c).bigHour=!0});var Hd=/[ap]\.?m?\.?/i,Id=C("Hours",!0);H("m",["mm",2],0,"minute"),z("minute","m"),N("m",Wc),N("mm",Wc,Sc),Q(["m","mm"],jd);var Jd=C("Minutes",!1);H("s",["ss",2],0,"second"),z("second","s"),N("s",Wc),N("ss",Wc,Sc),Q(["s","ss"],kd);var Kd=C("Seconds",!1);H("S",0,0,function(){return~~(this.millisecond()/100)}),H(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),H(0,["SSS",3],0,"millisecond"),H(0,["SSSS",4],0,function(){return 10*this.millisecond()}),H(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),H(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),H(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),H(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),H(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),z("millisecond","ms"),N("S",Xc,Rc),N("SS",Xc,Sc),N("SSS",Xc,Tc);var Ld;for(Ld="SSSS";Ld.length<=9;Ld+="S")N(Ld,$c);for(Ld="S";Ld.length<=9;Ld+="S")Q(Ld,Wb);var Md=C("Milliseconds",!1);H("z",0,0,"zoneAbbr"),H("zz",0,0,"zoneName");var Nd=n.prototype;Nd.add=Ad,Nd.calendar=cb,Nd.clone=db,Nd.diff=ib,Nd.endOf=ub,Nd.format=mb,Nd.from=nb,Nd.fromNow=ob,Nd.to=pb,Nd.toNow=qb,Nd.get=F,Nd.invalidAt=Cb,Nd.isAfter=eb,Nd.isBefore=fb,Nd.isBetween=gb,Nd.isSame=hb,Nd.isValid=Ab,Nd.lang=Cd,Nd.locale=rb,Nd.localeData=sb,Nd.max=wd,Nd.min=vd,Nd.parsingFlags=Bb,Nd.set=F,Nd.startOf=tb,Nd.subtract=Bd,Nd.toArray=yb,Nd.toObject=zb,Nd.toDate=xb,Nd.toISOString=lb,Nd.toJSON=lb,Nd.toString=kb,Nd.unix=wb,Nd.valueOf=vb,Nd.year=td,Nd.isLeapYear=ia,Nd.weekYear=Fb,Nd.isoWeekYear=Gb,Nd.quarter=Nd.quarters=Jb,Nd.month=Y,Nd.daysInMonth=Z,Nd.week=Nd.weeks=na,Nd.isoWeek=Nd.isoWeeks=oa,Nd.weeksInYear=Ib,Nd.isoWeeksInYear=Hb,Nd.date=Dd,Nd.day=Nd.days=Pb,Nd.weekday=Qb,Nd.isoWeekday=Rb,Nd.dayOfYear=qa,Nd.hour=Nd.hours=Id,Nd.minute=Nd.minutes=Jd,Nd.second=Nd.seconds=Kd, + Nd.millisecond=Nd.milliseconds=Md,Nd.utcOffset=Na,Nd.utc=Pa,Nd.local=Qa,Nd.parseZone=Ra,Nd.hasAlignedHourOffset=Sa,Nd.isDST=Ta,Nd.isDSTShifted=Ua,Nd.isLocal=Va,Nd.isUtcOffset=Wa,Nd.isUtc=Xa,Nd.isUTC=Xa,Nd.zoneAbbr=Xb,Nd.zoneName=Yb,Nd.dates=aa("dates accessor is deprecated. Use date instead.",Dd),Nd.months=aa("months accessor is deprecated. Use month instead",Y),Nd.years=aa("years accessor is deprecated. Use year instead",td),Nd.zone=aa("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Oa);var Od=Nd,Pd={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Qd={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},Rd="Invalid date",Sd="%d",Td=/\d{1,2}/,Ud={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Vd=s.prototype;Vd._calendar=Pd,Vd.calendar=_b,Vd._longDateFormat=Qd,Vd.longDateFormat=ac,Vd._invalidDate=Rd,Vd.invalidDate=bc,Vd._ordinal=Sd,Vd.ordinal=cc,Vd._ordinalParse=Td,Vd.preparse=dc,Vd.postformat=dc,Vd._relativeTime=Ud,Vd.relativeTime=ec,Vd.pastFuture=fc,Vd.set=gc,Vd.months=U,Vd._months=md,Vd.monthsShort=V,Vd._monthsShort=nd,Vd.monthsParse=W,Vd.week=ka,Vd._week=ud,Vd.firstDayOfYear=ma,Vd.firstDayOfWeek=la,Vd.weekdays=Lb,Vd._weekdays=Ed,Vd.weekdaysMin=Nb,Vd._weekdaysMin=Gd,Vd.weekdaysShort=Mb,Vd._weekdaysShort=Fd,Vd.weekdaysParse=Ob,Vd.isPM=Ub,Vd._meridiemParse=Hd,Vd.meridiem=Vb,w("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===q(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=aa("moment.lang is deprecated. Use moment.locale instead.",w),a.langData=aa("moment.langData is deprecated. Use moment.localeData instead.",y);var Wd=Math.abs,Xd=yc("ms"),Yd=yc("s"),Zd=yc("m"),$d=yc("h"),_d=yc("d"),ae=yc("w"),be=yc("M"),ce=yc("y"),de=Ac("milliseconds"),ee=Ac("seconds"),fe=Ac("minutes"),ge=Ac("hours"),he=Ac("days"),ie=Ac("months"),je=Ac("years"),ke=Math.round,le={s:45,m:45,h:22,d:26,M:11},me=Math.abs,ne=Ha.prototype;ne.abs=oc,ne.add=qc,ne.subtract=rc,ne.as=wc,ne.asMilliseconds=Xd,ne.asSeconds=Yd,ne.asMinutes=Zd,ne.asHours=$d,ne.asDays=_d,ne.asWeeks=ae,ne.asMonths=be,ne.asYears=ce,ne.valueOf=xc,ne._bubble=tc,ne.get=zc,ne.milliseconds=de,ne.seconds=ee,ne.minutes=fe,ne.hours=ge,ne.days=he,ne.weeks=Bc,ne.months=ie,ne.years=je,ne.humanize=Fc,ne.toISOString=Gc,ne.toString=Gc,ne.toJSON=Gc,ne.locale=rb,ne.localeData=sb,ne.toIsoString=aa("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Gc),ne.lang=Cd,H("X",0,0,"unix"),H("x",0,0,"valueOf"),N("x",_c),N("X",bd),Q("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),Q("x",function(a,b,c){c._d=new Date(q(a))}),a.version="2.10.6",b(Da),a.fn=Od,a.min=Fa,a.max=Ga,a.utc=h,a.unix=Zb,a.months=jc,a.isDate=d,a.locale=w,a.invalid=l,a.duration=Ya,a.isMoment=o,a.weekdays=lc,a.parseZone=$b,a.localeData=y,a.isDuration=Ia,a.monthsShort=kc,a.weekdaysMin=nc,a.defineLocale=x,a.weekdaysShort=mc,a.normalizeUnits=A,a.relativeTimeThreshold=Ec;var oe=a;return oe}); \ No newline at end of file diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index 67947ce2c..756a5e241 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -7,6 +7,7 @@ @import "bootstrap-datepicker.standalone"; @import "jquery.mloading"; @import "jquery-confirm.min"; +@import "bootstrap-datetimepicker.min"; @import "codemirror/lib/codemirror"; @import "editormd/css/editormd.min"; diff --git a/app/assets/stylesheets/admins/competition_settings.scss b/app/assets/stylesheets/admins/competition_settings.scss index fca2a198d..690cc2207 100644 --- a/app/assets/stylesheets/admins/competition_settings.scss +++ b/app/assets/stylesheets/admins/competition_settings.scss @@ -37,7 +37,7 @@ } .setBtn_s{ height: 35px; - line-height: 5px; + line-height: 20px; } .large_panel{ diff --git a/app/assets/stylesheets/bootstrap-datetimepicker.min.css b/app/assets/stylesheets/bootstrap-datetimepicker.min.css new file mode 100755 index 000000000..78485fee7 --- /dev/null +++ b/app/assets/stylesheets/bootstrap-datetimepicker.min.css @@ -0,0 +1,9 @@ +/*! + * Datetimepicker for Bootstrap + * + * Copyright 2012 Stefan Petre + * Improvements by Andrew Rowls + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + */.datetimepicker{padding:4px;margin-top:1px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;direction:ltr}.datetimepicker-inline{width:220px}.datetimepicker.datetimepicker-rtl{direction:rtl}.datetimepicker.datetimepicker-rtl table tr td span{float:right}.datetimepicker-dropdown,.datetimepicker-dropdown-left{top:0;left:0}[class*=" datetimepicker-dropdown"]:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-bottom-color:rgba(0,0,0,0.2);position:absolute}[class*=" datetimepicker-dropdown"]:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff;position:absolute}[class*=" datetimepicker-dropdown-top"]:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-top:7px solid #ccc;border-top-color:rgba(0,0,0,0.2);border-bottom:0}[class*=" datetimepicker-dropdown-top"]:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #fff;border-bottom:0}.datetimepicker-dropdown-bottom-left:before{top:-7px;right:6px}.datetimepicker-dropdown-bottom-left:after{top:-6px;right:7px}.datetimepicker-dropdown-bottom-right:before{top:-7px;left:6px}.datetimepicker-dropdown-bottom-right:after{top:-6px;left:7px}.datetimepicker-dropdown-top-left:before{bottom:-7px;right:6px}.datetimepicker-dropdown-top-left:after{bottom:-6px;right:7px}.datetimepicker-dropdown-top-right:before{bottom:-7px;left:6px}.datetimepicker-dropdown-top-right:after{bottom:-6px;left:7px}.datetimepicker>div{display:none}.datetimepicker.minutes div.datetimepicker-minutes{display:block}.datetimepicker.hours div.datetimepicker-hours{display:block}.datetimepicker.days div.datetimepicker-days{display:block}.datetimepicker.months div.datetimepicker-months{display:block}.datetimepicker.years div.datetimepicker-years{display:block}.datetimepicker table{margin:0}.datetimepicker td,.datetimepicker th{text-align:center;width:20px;height:20px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;border:0}.table-striped .datetimepicker table tr td,.table-striped .datetimepicker table tr th{background-color:transparent}.datetimepicker table tr td.minute:hover{background:#eee;cursor:pointer}.datetimepicker table tr td.hour:hover{background:#eee;cursor:pointer}.datetimepicker table tr td.day:hover{background:#eee;cursor:pointer}.datetimepicker table tr td.old,.datetimepicker table tr td.new{color:#999}.datetimepicker table tr td.disabled,.datetimepicker table tr td.disabled:hover{background:0;color:#999;cursor:default}.datetimepicker table tr td.today,.datetimepicker table tr td.today:hover,.datetimepicker table tr td.today.disabled,.datetimepicker table tr td.today.disabled:hover{background-color:#fde19a;background-image:-moz-linear-gradient(top,#fdd49a,#fdf59a);background-image:-ms-linear-gradient(top,#fdd49a,#fdf59a);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fdd49a),to(#fdf59a));background-image:-webkit-linear-gradient(top,#fdd49a,#fdf59a);background-image:-o-linear-gradient(top,#fdd49a,#fdf59a);background-image:linear-gradient(to bottom,#fdd49a,#fdf59a);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a',endColorstr='#fdf59a',GradientType=0);border-color:#fdf59a #fdf59a #fbed50;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.datetimepicker table tr td.today:hover,.datetimepicker table tr td.today:hover:hover,.datetimepicker table tr td.today.disabled:hover,.datetimepicker table tr td.today.disabled:hover:hover,.datetimepicker table tr td.today:active,.datetimepicker table tr td.today:hover:active,.datetimepicker table tr td.today.disabled:active,.datetimepicker table tr td.today.disabled:hover:active,.datetimepicker table tr td.today.active,.datetimepicker table tr td.today:hover.active,.datetimepicker table tr td.today.disabled.active,.datetimepicker table tr td.today.disabled:hover.active,.datetimepicker table tr td.today.disabled,.datetimepicker table tr td.today:hover.disabled,.datetimepicker table tr td.today.disabled.disabled,.datetimepicker table tr td.today.disabled:hover.disabled,.datetimepicker table tr td.today[disabled],.datetimepicker table tr td.today:hover[disabled],.datetimepicker table tr td.today.disabled[disabled],.datetimepicker table tr td.today.disabled:hover[disabled]{background-color:#fdf59a}.datetimepicker table tr td.today:active,.datetimepicker table tr td.today:hover:active,.datetimepicker table tr td.today.disabled:active,.datetimepicker table tr td.today.disabled:hover:active,.datetimepicker table tr td.today.active,.datetimepicker table tr td.today:hover.active,.datetimepicker table tr td.today.disabled.active,.datetimepicker table tr td.today.disabled:hover.active{background-color:#fbf069}.datetimepicker table tr td.active,.datetimepicker table tr td.active:hover,.datetimepicker table tr td.active.disabled,.datetimepicker table tr td.active.disabled:hover{background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-ms-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc',endColorstr='#0044cc',GradientType=0);border-color:#04c #04c #002a80;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25)}.datetimepicker table tr td.active:hover,.datetimepicker table tr td.active:hover:hover,.datetimepicker table tr td.active.disabled:hover,.datetimepicker table tr td.active.disabled:hover:hover,.datetimepicker table tr td.active:active,.datetimepicker table tr td.active:hover:active,.datetimepicker table tr td.active.disabled:active,.datetimepicker table tr td.active.disabled:hover:active,.datetimepicker table tr td.active.active,.datetimepicker table tr td.active:hover.active,.datetimepicker table tr td.active.disabled.active,.datetimepicker table tr td.active.disabled:hover.active,.datetimepicker table tr td.active.disabled,.datetimepicker table tr td.active:hover.disabled,.datetimepicker table tr td.active.disabled.disabled,.datetimepicker table tr td.active.disabled:hover.disabled,.datetimepicker table tr td.active[disabled],.datetimepicker table tr td.active:hover[disabled],.datetimepicker table tr td.active.disabled[disabled],.datetimepicker table tr td.active.disabled:hover[disabled]{background-color:#04c}.datetimepicker table tr td.active:active,.datetimepicker table tr td.active:hover:active,.datetimepicker table tr td.active.disabled:active,.datetimepicker table tr td.active.disabled:hover:active,.datetimepicker table tr td.active.active,.datetimepicker table tr td.active:hover.active,.datetimepicker table tr td.active.disabled.active,.datetimepicker table tr td.active.disabled:hover.active{background-color:#039}.datetimepicker table tr td span{display:block;width:23%;height:54px;line-height:54px;float:left;margin:1%;cursor:pointer;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.datetimepicker .datetimepicker-hours span{height:26px;line-height:26px}.datetimepicker .datetimepicker-hours table tr td span.hour_am,.datetimepicker .datetimepicker-hours table tr td span.hour_pm{width:14.6%}.datetimepicker .datetimepicker-hours fieldset legend,.datetimepicker .datetimepicker-minutes fieldset legend{margin-bottom:inherit;line-height:30px}.datetimepicker .datetimepicker-minutes span{height:26px;line-height:26px}.datetimepicker table tr td span:hover{background:#eee}.datetimepicker table tr td span.disabled,.datetimepicker table tr td span.disabled:hover{background:0;color:#999;cursor:default}.datetimepicker table tr td span.active,.datetimepicker table tr td span.active:hover,.datetimepicker table tr td span.active.disabled,.datetimepicker table tr td span.active.disabled:hover{background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-ms-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc',endColorstr='#0044cc',GradientType=0);border-color:#04c #04c #002a80;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25)}.datetimepicker table tr td span.active:hover,.datetimepicker table tr td span.active:hover:hover,.datetimepicker table tr td span.active.disabled:hover,.datetimepicker table tr td span.active.disabled:hover:hover,.datetimepicker table tr td span.active:active,.datetimepicker table tr td span.active:hover:active,.datetimepicker table tr td span.active.disabled:active,.datetimepicker table tr td span.active.disabled:hover:active,.datetimepicker table tr td span.active.active,.datetimepicker table tr td span.active:hover.active,.datetimepicker table tr td span.active.disabled.active,.datetimepicker table tr td span.active.disabled:hover.active,.datetimepicker table tr td span.active.disabled,.datetimepicker table tr td span.active:hover.disabled,.datetimepicker table tr td span.active.disabled.disabled,.datetimepicker table tr td span.active.disabled:hover.disabled,.datetimepicker table tr td span.active[disabled],.datetimepicker table tr td span.active:hover[disabled],.datetimepicker table tr td span.active.disabled[disabled],.datetimepicker table tr td span.active.disabled:hover[disabled]{background-color:#04c}.datetimepicker table tr td span.active:active,.datetimepicker table tr td span.active:hover:active,.datetimepicker table tr td span.active.disabled:active,.datetimepicker table tr td span.active.disabled:hover:active,.datetimepicker table tr td span.active.active,.datetimepicker table tr td span.active:hover.active,.datetimepicker table tr td span.active.disabled.active,.datetimepicker table tr td span.active.disabled:hover.active{background-color:#039}.datetimepicker table tr td span.old{color:#999}.datetimepicker th.switch{width:145px}.datetimepicker th span.glyphicon{pointer-events:none}.datetimepicker thead tr:first-child th,.datetimepicker tfoot th{cursor:pointer}.datetimepicker thead tr:first-child th:hover,.datetimepicker tfoot th:hover{background:#eee}.input-append.date .add-on i,.input-prepend.date .add-on i,.input-group.date .input-group-addon span{cursor:pointer;width:14px;height:14px} \ No newline at end of file diff --git a/app/controllers/admins/competition_settings_controller.rb b/app/controllers/admins/competition_settings_controller.rb index 9fee83c3e..c905c4644 100644 --- a/app/controllers/admins/competition_settings_controller.rb +++ b/app/controllers/admins/competition_settings_controller.rb @@ -24,6 +24,6 @@ class Admins::CompetitionSettingsController < Admins::BaseController end def nav_form_params - params.permit(:enroll_end_time, competition_staffs: %i[category minimum maximum mutiple_limited], nav_module: %i[module_type name hidden position url]) + params.permit(:enroll_end_time, competition_staffs: %i[category minimum maximum mutiple_limited], navbar: %i[module_type name hidden position url]) end end \ No newline at end of file diff --git a/app/controllers/admins/competition_stages_controller.rb b/app/controllers/admins/competition_stages_controller.rb index 19c400a90..537240bde 100644 --- a/app/controllers/admins/competition_stages_controller.rb +++ b/app/controllers/admins/competition_stages_controller.rb @@ -67,6 +67,10 @@ class Admins::CompetitionStagesController < Admins::BaseController render_ok end + def calculate_stage_score + + end + private def current_competition diff --git a/app/controllers/admins/users_controller.rb b/app/controllers/admins/users_controller.rb index cdb64c71f..6aaec04e1 100644 --- a/app/controllers/admins/users_controller.rb +++ b/app/controllers/admins/users_controller.rb @@ -32,13 +32,13 @@ class Admins::UsersController < Admins::BaseController end def lock - User.find(params[:user_id]).lock! + User.find(params[:id]).lock! render_ok end def unlock - User.find(params[:user_id]).activate! + User.find(params[:id]).activate! render_ok end diff --git a/app/controllers/competitions/competition_teams_controller.rb b/app/controllers/competitions/competition_teams_controller.rb index db4608807..0bc61201a 100644 --- a/app/controllers/competitions/competition_teams_controller.rb +++ b/app/controllers/competitions/competition_teams_controller.rb @@ -59,6 +59,7 @@ class Competitions::CompetitionTeamsController < Competitions::BaseController end def index + @competition = current_competition @personal = current_competition.personal? if admin_or_business? all_competition_teams diff --git a/app/controllers/competitions/competitions_controller.rb b/app/controllers/competitions/competitions_controller.rb index 2cae06774..009c3183f 100644 --- a/app/controllers/competitions/competitions_controller.rb +++ b/app/controllers/competitions/competitions_controller.rb @@ -70,12 +70,15 @@ class Competitions::CompetitionsController < Competitions::BaseController def update_md_content tip_exception("标题和内容不能为空") if params[:name].blank? || params[:content].blank? + tip_exception("缺少competition_module_id") if params[:competition_module_id].blank? ActiveRecord::Base.transaction do + com_module = current_competition.competition_modules.find_by!(id: params[:competition_module_id]) if params[:md_content_id] - md_content = CompetitionModuleMdContent.find_by!(id: params[:md_content_id]) + md_content = CompetitionModuleMdContent.find_by!(id: params[:md_content_id], competition_module_id: com_module.id) md_content.update_attributes!(name: params[:name], content: params[:content]) else - md_content = CompetitionModuleMdContent.create!(name: params[:name], content: params[:content]) + stage = current_competition.competition_stages.find_by(id: params[:stage_id]) if params[:stage_id] + md_content = CompetitionModuleMdContent.create!(name: params[:name], content: params[:content], competition_module_id: com_module.id, competition_stage_id: stage&.id.to_i) end Attachment.associate_container(params[:attachment_ids], md_content.id, md_content.class) if params[:attachment_ids] normal_status("更新成功") @@ -84,8 +87,8 @@ class Competitions::CompetitionsController < Competitions::BaseController def chart_rules @competition = current_competition - @stages = @competition.competition_stages - @rule_contents = @competition.chart_rules + com_module = @competition.competition_modules.find_by(module_type: "chart") + @rule_contents = com_module&.competition_module_md_contents end def update_chart_rules diff --git a/app/controllers/cooperative/users_controller.rb b/app/controllers/cooperative/users_controller.rb index 8d6e5f52a..4c6539147 100644 --- a/app/controllers/cooperative/users_controller.rb +++ b/app/controllers/cooperative/users_controller.rb @@ -2,9 +2,14 @@ class Cooperative::UsersController < Cooperative::BaseController def index params[:sort_by] = params[:sort_by].presence || 'created_on' params[:sort_direction] = params[:sort_direction].presence || 'desc' - params[:school_id] = current_laboratory.school_id - users = Admins::UserQuery.call(params) + users = Admins::UserQuery.call(search_params) @users = paginate users.includes(user_extension: :school) end + + private + + def search_params + params.permit(:name, :sort_by, :sort_direction) + end end \ No newline at end of file diff --git a/app/controllers/weapps/code_sessions_controller.rb b/app/controllers/weapps/code_sessions_controller.rb index a99a048e2..c92c3cb70 100644 --- a/app/controllers/weapps/code_sessions_controller.rb +++ b/app/controllers/weapps/code_sessions_controller.rb @@ -30,7 +30,7 @@ class Weapps::CodeSessionsController < Weapps::BaseController set_session_openid(result['openid']) set_weapp_session_key(result['session_key']) # weapp session_key写入缓存 后续解密需要 - render_ok(openid: result['openid'], logged: logged) + render_ok(openid: result['openid'], logged: logged) unless logged rescue Wechat::Error => ex render_error(ex.message) end diff --git a/app/controllers/weapps/sessions_controller.rb b/app/controllers/weapps/sessions_controller.rb index f65111399..371a3f7d3 100644 --- a/app/controllers/weapps/sessions_controller.rb +++ b/app/controllers/weapps/sessions_controller.rb @@ -19,6 +19,5 @@ class Weapps::SessionsController < Weapps::BaseController OpenUsers::Wechat.create!(user: user, uid: session_unionid) if user.wechat_open_user.blank? successful_authentication(user) - render_ok end end \ No newline at end of file diff --git a/app/forms/competitions/save_team_form.rb b/app/forms/competitions/save_team_form.rb index dd2610083..6b418eec8 100644 --- a/app/forms/competitions/save_team_form.rb +++ b/app/forms/competitions/save_team_form.rb @@ -86,6 +86,7 @@ class Competitions::SaveTeamForm # 创建者是否能多次报名 def check_creator_multiple_enrollable + return unless team.new_record? # 编辑战队时不需要校验 return unless competition.enrolled?(creator) if (creator.is_teacher? && competition.teacher_multiple_limited?) || (!creator.is_teacher? && competition.member_multiple_limited?) diff --git a/app/helpers/competitions_helper.rb b/app/helpers/competitions_helper.rb index 9e3e7f62a..ebafe4e02 100644 --- a/app/helpers/competitions_helper.rb +++ b/app/helpers/competitions_helper.rb @@ -37,7 +37,7 @@ module CompetitionsHelper def chart_stages competition stages = [] - statistic_stages = competition.competition_stages.where("rate > 0") + statistic_stages = competition.competition_stages.where("score_rate > 0") if competition.end_time && competition.end_time < Time.now && statistic_stages.size > 1 stages << {id: nil, name: "总排行榜", rate: 1.0, start_time: competition.start_time, end_time: competition.end_time} end diff --git a/app/jobs/sync_trustie_job.rb b/app/jobs/sync_trustie_job.rb new file mode 100644 index 000000000..89c0b8375 --- /dev/null +++ b/app/jobs/sync_trustie_job.rb @@ -0,0 +1,25 @@ +require 'uri' +require 'net/http' + +class SyncTrustieJob < ApplicationJob + queue_as :default + + def perform(type, count) + Rails.logger.info("#######_________response__sync__start__#########") + configs_content = Rails.application.config_for(:configuration) + + token = configs_content["sync_token"] + token_url = configs_content["sync_url"] + url = "#{token_url}/api/v1/homes/sync_count" + sync_json = { + "token": token, + "type": type, + "number": count + } + uri = URI.parse(url) + + http = Net::HTTP.new(uri.hostname, uri.port) + http.send_request('PUT', uri.path, sync_json.to_json, {'Content-Type' => 'application/json'}) + Rails.logger.info("#######_________response__sync__end_____#########") + end +end \ No newline at end of file diff --git a/app/libs/util.rb b/app/libs/util.rb index 38b5c9af5..1db9460f0 100644 --- a/app/libs/util.rb +++ b/app/libs/util.rb @@ -60,7 +60,7 @@ module Util return if str.blank? case type - when :phone then "#{str[0..2]}***#{str[-3..-1]}" + when :phone then "#{str[0..2]}****#{str[-4..-1]}" when :email then "#{str[0]}***#{str[(str.rindex('@')-1)..-1]}" else "#{str[0..2]}***#{str[-3..-1]}" end diff --git a/app/models/competition.rb b/app/models/competition.rb index 39e4f4dfe..130cd270d 100644 --- a/app/models/competition.rb +++ b/app/models/competition.rb @@ -66,7 +66,7 @@ class Competition < ApplicationRecord # 是否为个人赛 def personal? - competition_staffs.maximum(:maximum) == 1 || max_num == 1 + competition_staffs.maximum(:maximum) == 1 || (competition_staffs.nil? && max_num == 1) end # 报名是否结束 diff --git a/app/models/competition_module.rb b/app/models/competition_module.rb index 76f7610d2..3b1bfddda 100644 --- a/app/models/competition_module.rb +++ b/app/models/competition_module.rb @@ -3,22 +3,16 @@ class CompetitionModule < ApplicationRecord belongs_to :competition - has_one :competition_module_md_content, dependent: :destroy + has_many :competition_module_md_contents, dependent: :destroy def module_url - case module_type - when "home" - "/competitions/#{competition.identifier}" - when "inform" - "/competitions/#{competition.identifier}/informs?status=1" - when "manual" - "/competitions/#{competition.identifier}/informs?status=2" - when "chart" - "/competitions/#{competition.identifier}/charts" - when "enroll" - "/competitions/#{competition.identifier}/competition_teams" - else - url || "/competitions/#{competition.identifier}/md_content?md_content_id=#{competition_module_md_content&.id}" - end + result_url = url.present? ? url : case module_type + when "chart" + "/competitions/#{competition.identifier}/charts.json" + when "enroll" + "/competitions/#{competition.identifier}/competition_teams.json" + else + "/competitions/#{competition.identifier}/competition_modules/#{id}.json" + end end end diff --git a/app/models/competition_module_md_content.rb b/app/models/competition_module_md_content.rb index 9dfcfca84..4a8dacf9e 100644 --- a/app/models/competition_module_md_content.rb +++ b/app/models/competition_module_md_content.rb @@ -3,6 +3,6 @@ class CompetitionModuleMdContent < ApplicationRecord has_many :attachments, as: :container, dependent: :destroy - validates :name, presence: true + # validates :name, presence: true validates :content, presence: true end \ No newline at end of file diff --git a/app/models/competition_team.rb b/app/models/competition_team.rb index 6c2b99859..a05ceb032 100644 --- a/app/models/competition_team.rb +++ b/app/models/competition_team.rb @@ -28,7 +28,7 @@ class CompetitionTeam < ApplicationRecord while self.class.exists?(invite_code: code) code = CODE_CHARS.sample(6).join end - self.code = code + self.invite_code = code code end diff --git a/app/models/project.rb b/app/models/project.rb index c3c626cb0..c884935d8 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -8,6 +8,8 @@ class Project < ApplicationRecord has_many :issues has_many :user_grades, dependent: :destroy + after_create :sync_project_trustie #同步到trustie + # 创建者 def creator User.find(user_id).full_name @@ -20,4 +22,8 @@ class Project < ApplicationRecord def member?(user) members.exists?(user_id: user.id) end + + def sync_project_trustie + SyncTrustieJob.perform_later("project", 1) + end end diff --git a/app/models/school.rb b/app/models/school.rb index 387b6b5d8..1608377a6 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -19,6 +19,8 @@ class School < ApplicationRecord has_many :apply_add_departments, dependent: :destroy has_many :user_extensions, dependent: :nullify + after_create :sync_school_trustie #同步到trustie + # 学校管理员 def manager?(user) ec_school_users.exists?(user_id: user.id) @@ -39,4 +41,8 @@ class School < ApplicationRecord def manage_permission?(user) manager?(user) || major_manager?(user) || course_manager?(user) end + + def sync_school_trustie + SyncTrustieJob.perform_later("school", 1) + end end diff --git a/app/models/shixun.rb b/app/models/shixun.rb index 38df5f0d4..744d486e3 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -75,7 +75,7 @@ class Shixun < ApplicationRecord scope :field_for_recommend, lambda{ select([:id, :name, :identifier, :myshixuns_count]) } scope :find_by_ids,lambda{|k| where(id:k)} - after_create :send_tiding + after_create :send_tiding, :sync_shixun_trustie #同步到trustie # REDO:  def propaedeutics @@ -290,6 +290,10 @@ class Shixun < ApplicationRecord subjects.where(hidden: 0).uniq end + def sync_shixun_trustie + SyncTrustieJob.perform_later("practical_training_project", 1) + end + private def send_tiding diff --git a/app/models/user.rb b/app/models/user.rb index 135b85e25..6b5fc62ee 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -156,6 +156,7 @@ class User < ApplicationRecord delegate :gender, :department_id, :school_id, :location, :location_city, :technical_title, to: :user_extension, allow_nil: true before_save :update_hashed_password + after_create :sync_user_trustie #同步到trustie # # validations @@ -313,6 +314,10 @@ class User < ApplicationRecord shixun.shixun_members.exists?(role: 2, user_id: id) end + def sync_user_trustie + SyncTrustieJob.perform_later("user", 1) + end + # TPI的创建者 def creator_of_game?(game) id == game.user_id @@ -661,6 +666,10 @@ class User < ApplicationRecord if password.present? && password.size < MIX_PASSWORD_LIMIT && !User.current.admin? raise("密码长度不能低于#{MIX_PASSWORD_LIMIT}位") end + + if password.present? && password.size > 16 + raise('密码长度不能超过16位') + end end end diff --git a/app/services/admins/competition_basic_setting_service.rb b/app/services/admins/competition_basic_setting_service.rb index e5a7dd6be..d943b1cb0 100644 --- a/app/services/admins/competition_basic_setting_service.rb +++ b/app/services/admins/competition_basic_setting_service.rb @@ -21,7 +21,7 @@ class Admins::CompetitionBasicSettingService < ApplicationService competition.save! if competition.mode == 1 || competition.mode == 4 - competition.competition_mode_setting.destroy + competition.competition_mode_setting&.destroy else setting = competition.competition_mode_setting || CompetitionModeSetting.create!(competition_id: competition.id) if competition.mode == 2 diff --git a/app/services/admins/competition_nav_setting_service.rb b/app/services/admins/competition_nav_setting_service.rb index 13b58a799..4254dd060 100644 --- a/app/services/admins/competition_nav_setting_service.rb +++ b/app/services/admins/competition_nav_setting_service.rb @@ -13,16 +13,17 @@ class Admins::CompetitionNavSettingService < ApplicationService # hidden_module_type = competition.all_module_types - params[:module_type] # competition.competition_modules.where(module_type: hidden_module_type).update_all(hidden: 1) - params[:nav_module].each do |nav| + params[:navbar].each do |nav| module_type = nav["module_type"] if competition.all_module_types.include?(module_type) com_module = competition.competition_modules.find_by(module_type: module_type) else com_module = CompetitionModule.create!(competition_id: competition.id, module_type: 'md') end - com_module.update_attributes!(hidden: nav["hidden"] ? 0 : 1, position: nav["position"], name: nav["name"], url: nav["url"]) + com_module.update_attributes!(hidden: nav["hidden"] ? 0 : 1, position: nav["position"] ? nav["position"] : com_module.position, name: nav["name"], url: nav["url"]) end + competition.update_attributes!(enroll_end_time: params[:enroll_end_time]) if params[:competition_staffs].present? competition.competition_staffs.delete_all params[:competition_staffs].each_with_index do |staff_params, index| diff --git a/app/services/competitions/create_personal_team_service.rb b/app/services/competitions/create_personal_team_service.rb index 7f2123ce7..907c59dc0 100644 --- a/app/services/competitions/create_personal_team_service.rb +++ b/app/services/competitions/create_personal_team_service.rb @@ -21,7 +21,7 @@ class Competitions::CreatePersonalTeamService < ApplicationService ActiveRecord::Base.transaction do team = competition.competition_teams.create!(name: user.real_name, user_id: user.id) - team.team_members.create!(competition_id: competition, user_id: user.id, role: 1, is_teacher: is_teacher) + team.team_members.create!(competition_id: competition.id, user_id: user.id, role: 1, is_teacher: is_teacher) end end end \ No newline at end of file diff --git a/app/services/competitions/save_team_service.rb b/app/services/competitions/save_team_service.rb index 1021e6e6d..233648fbb 100644 --- a/app/services/competitions/save_team_service.rb +++ b/app/services/competitions/save_team_service.rb @@ -32,7 +32,7 @@ class Competitions::SaveTeamService < ApplicationService private def update_teacher_team_members! - teacher_ids = Array.wrap(params[:teacher_ids]).map(:to_i) + teacher_ids = Array.wrap(params[:teacher_ids]).map(&:to_i) old_teacher_ids = team.team_members.where(role: 3).pluck(:user_id) destroy_teacher_ids = old_teacher_ids - teacher_ids @@ -49,7 +49,7 @@ class Competitions::SaveTeamService < ApplicationService end def update_member_team_members! - member_ids = Array.wrap(params[:member_ids]).map(:to_i) + member_ids = Array.wrap(params[:member_ids]).map(&:to_i) old_member_ids = team.team_members.where(role: 2).pluck(:user_id) destroy_member_ids = old_member_ids - member_ids diff --git a/app/services/oauth/create_or_find_qq_account_service.rb b/app/services/oauth/create_or_find_qq_account_service.rb index 200d436ef..c258993bd 100644 --- a/app/services/oauth/create_or_find_qq_account_service.rb +++ b/app/services/oauth/create_or_find_qq_account_service.rb @@ -16,7 +16,7 @@ class Oauth::CreateOrFindQqAccountService < ApplicationService if user.blank? || !user.logged? new_user = true # 新用户 - login = User.generate_login('q') + login = User.generate_login('Q') @user = User.new(login: login, nickname: params.dig('info', 'nickname'), type: 'User', status: User::STATUS_ACTIVE) end @@ -26,6 +26,9 @@ class Oauth::CreateOrFindQqAccountService < ApplicationService gender = params.dig('extra', 'raw_info', 'gender') == '女' ? 1 : 0 user.create_user_extension!(gender: gender) + # 下载头像 + avatar_path = Util::FileManage.source_disk_filename(user) + Util.download_file(params.dig('info', 'figureurl_qq_1'), avatar_path) end new_open_user = OpenUsers::QQ.create!(user: user, uid: params['uid'], extra: params.dig('extra', 'raw_info')) diff --git a/app/tasks/sync_trustie_task.rb b/app/tasks/sync_trustie_task.rb new file mode 100644 index 000000000..62b87954f --- /dev/null +++ b/app/tasks/sync_trustie_task.rb @@ -0,0 +1,22 @@ +#初始化同步educoder的人数,项目数,高校数,实训数,到Trustie平台,只需运行一次 + +class SyncTrustieTask + + def sync_format + Rails.logger.info("########________sync_to_trustie_start_________###########") + + users_count = User.all.size + projects_count = Project.all.size + + shixuns_count = Shixun.all.size + schools_count = School.all.size + + SyncTrustieJob.perform_later("user", users_count) + SyncTrustieJob.perform_later("project", projects_count) + SyncTrustieJob.perform_later("practical_training_project", shixuns_count) + SyncTrustieJob.perform_later("school", schools_count) + + Rails.logger.info("########________sync_to_trustie_end_________###########") + end + +end \ No newline at end of file diff --git a/app/views/admins/competition_settings/index.html.erb b/app/views/admins/competition_settings/index.html.erb index 7a005a416..6549ee0e2 100644 --- a/app/views/admins/competition_settings/index.html.erb +++ b/app/views/admins/competition_settings/index.html.erb @@ -35,8 +35,8 @@ 起止时间
- <%= text_field_tag :start_time, @competition.start_time&.strftime('%Y-%m-%d'), autocomplete: 'off', class: 'form-control start-date mx-0 mr-2', placeholder: '竞赛开始时间' %> - <%= text_field_tag :end_time, @competition.end_time&.strftime('%Y-%m-%d'), autocomplete: 'off', class: 'form-control end-date mx-0', placeholder: '竞赛截止时间' %> + <%= text_field_tag :start_time, @competition.start_time&.strftime('%Y-%m-%d %H:%M:%S'), autocomplete: 'off', class: 'form-control start-date mx-0 mr-2', placeholder: '竞赛开始时间' %> + <%= text_field_tag :end_time, @competition.end_time&.strftime('%Y-%m-%d %H:%M:%S'), autocomplete: 'off', class: 'form-control end-date mx-0', placeholder: '竞赛截止时间' %>
@@ -151,125 +151,163 @@ 导航设置
-
-
-
-
- -
-
-
- -
-
-
-
- -
-
- 报名 -
-
-
-
  
-
- 报名截止时间 -
-
-
-
-
  
-
- 报名要求 -
-
- -
-
+ <%= form_tag(nav_setting_admins_competition_competition_settings_path(@competition), method: :post, class: 'nav-setting-form flex-1', remote: true) do %> +
+ <% @competition.competition_modules.each do |com_module| %> + <% case com_module.module_type %> + <% when 'home' %> +
+
+
+ +
+
+ <%= text_field_tag('navbar[][name]', com_module.name, id: nil, class: 'form-control', placeholder: '首页') %> + +
+
+ <%= text_field_tag('navbar[][position]', com_module.position, id: nil, class: 'form-control', placeholder: '位置') %> +
+
+
+ <% when 'enroll' %> +
+
+ +
+
+ + + 报名 +
+
+
+
  
+
+ 报名截止时间 +
+
+ <%= text_field_tag :enroll_end_time, @competition.enroll_end_time&.strftime('%Y-%m-%d'), autocomplete: 'off', class: 'form-control enroll_end_time', placeholder: '报名截止时间' %> +
+
+
+
  
+
+ 报名要求 +
+
+ <%= javascript_void_link '+', class: 'btn btn-primary waves-effect waves-light btn-xs setBtn_s addRequireBtn' %> +
+
-
+ <% when 'inform', 'chart', 'resource' %> +
+
+ +
+
+ + + <%= com_module.name %> +
+
+ <%= text_field_tag('navbar[][position]', com_module.position, id: nil, class: 'form-control', placeholder: '位置') %> +
+ <% if com_module.module_type == "resource" %> +
+ <%= text_field_tag('navbar[][url]', com_module.url, id: nil, class: 'form-control', placeholder: '请输入资料下载地址') %> +
+ <%= javascript_void_link '+', class: 'mt-1 btn btn-primary waves-effect waves-light btn-xs setBtn_s add_linkBtn' %> + <% end %> +
+ <% else %> +
+
+ +
+
+ + <%= text_field_tag('navbar[][name]', com_module.name, id: nil, class: 'form-control', placeholder: '请输入模块名称') %> +
+
+ <%= text_field_tag('navbar[][position]', com_module.position, id: nil, class: 'form-control', placeholder: '位置') %> +
+
+ <%= text_field_tag('navbar[][url]', com_module.url, id: nil, class: 'form-control', placeholder: '请输入资料下载地址') %> +
+ <%= javascript_void_link '+', class: 'mt-1 btn btn-primary waves-effect waves-light btn-xs setBtn_s add_linkBtn' %> + <%= javascript_void_link '×', class: 'mt-1 btn btn-icon waves-effect btn-default waves-light setBtn_s ml10 del_linkBtn' %> +
+ <% end %> + <% end %> + + + + + + + + + -
-
- -
-
排行榜
-
-
-
-
-
- -
-
资料下载
-
-
- -
-
-
-
- -
-
获奖证书
-
+
-
-
+
+
+
+
<%= javascript_void_link '保存', class: 'btn btn-primary submit-btn' %>
-
<%= javascript_void_link '保存', class: 'btn btn-primary submit-btn' %>
- -
+ <% end %>
diff --git a/app/views/admins/users/index.json.jbuilder b/app/views/admins/users/index.json.jbuilder index 5591474a4..5b1860928 100644 --- a/app/views/admins/users/index.json.jbuilder +++ b/app/views/admins/users/index.json.jbuilder @@ -1,6 +1,6 @@ json.count @users.total_count json.users do json.array! @users.each do |user| - json.extract! user, :id, :login, :real_name, :identity, :school_name + json.extract! user, :id, :login, :real_name, :identity, :school_name, :hidden_phone end end \ No newline at end of file diff --git a/app/views/admins/users/shared/_user_list.html.erb b/app/views/admins/users/shared/_user_list.html.erb index 36b5d0f6e..b3e911728 100644 --- a/app/views/admins/users/shared/_user_list.html.erb +++ b/app/views/admins/users/shared/_user_list.html.erb @@ -33,14 +33,14 @@ <%= javascript_void_link('奖励', class: 'action reward-grade-action', data: { toggle: 'modal', target: '.admin-users-reward-grade-modal', id: user.id }) %> - <%= javascript_void_link '解锁', class: 'action unlock-action', data: { id: user.id, confirm: '确认解锁吗?' }, style: user.locked? ? '' : 'display: none;' %> + <%= javascript_void_link '解锁', class: 'action unlock-action', data: { id: user.id }, style: user.locked? ? '' : 'display: none;' %> <% if user.registered? %> - <%= javascript_void_link '激活', class: 'action active-action', data: { id: user.id, confirm: '确认激活吗?' } %> + <%= javascript_void_link '激活', class: 'action active-action', data: { id: user.id } %> <% end %> <% if user.id != current_user.id %> - <%= javascript_void_link '加锁', class: 'action lock-action', data: { id: user.id, confirm: '确认加锁吗?' }, style: user.locked? || user.registered? ? 'display: none;' : '' %> + <%= javascript_void_link '加锁', class: 'action lock-action', data: { id: user.id }, style: user.locked? || user.registered? ? 'display: none;' : '' %> <% end %> <%= delete_link '删除', admins_user_path(user, element: ".user-item-#{user.id}"), class: 'delete-user-action' %> diff --git a/app/views/competitions/competition_modules/show.json.jbuilder b/app/views/competitions/competition_modules/show.json.jbuilder index 69cdcc544..ba2d79804 100644 --- a/app/views/competitions/competition_modules/show.json.jbuilder +++ b/app/views/competitions/competition_modules/show.json.jbuilder @@ -1,7 +1,7 @@ -json.extract! @module, :id, :name, :position, :url, :md_edit +json.extract! @module, :id, :name, :position, :url -md = @module.competition_module_md_content -if md.present? +mds = @module.competition_module_md_contents +json.md_contents mds.each do |md| json.md_name md.name json.md_content md.content json.created_at md.created_at.strftime('%Y-%m-%d %H:%M:%S') diff --git a/app/views/competitions/competition_teams/index.json.jbuilder b/app/views/competitions/competition_teams/index.json.jbuilder index 70651b4ae..3e5dc4d16 100644 --- a/app/views/competitions/competition_teams/index.json.jbuilder +++ b/app/views/competitions/competition_teams/index.json.jbuilder @@ -1,5 +1,6 @@ json.count @all_count json.personal @personal +json.competition_name @competition.name json.competition_teams do json.array! @all_teams&.each do |team| json.extract! team, :id, :name, :invite_code diff --git a/app/views/competitions/competitions/common_header.json.jbuilder b/app/views/competitions/competitions/common_header.json.jbuilder index a90ab14ee..0ecf6cfd5 100644 --- a/app/views/competitions/competitions/common_header.json.jbuilder +++ b/app/views/competitions/competitions/common_header.json.jbuilder @@ -9,6 +9,7 @@ json.enroll_end_time @competition.enroll_end_time&.strftime("%Y-%m-%d %H:%M:%S") json.published @competition.published? json.nearly_published @competition.published_at.present? +json.competition_status @competition.competition_status json.competition_modules @competition_modules do |com_module| json.(com_module, :id, :name, :position, :module_type) diff --git a/app/views/cooperative/users/index.json.jbuilder b/app/views/cooperative/users/index.json.jbuilder index 5591474a4..5b1860928 100644 --- a/app/views/cooperative/users/index.json.jbuilder +++ b/app/views/cooperative/users/index.json.jbuilder @@ -1,6 +1,6 @@ json.count @users.total_count json.users do json.array! @users.each do |user| - json.extract! user, :id, :login, :real_name, :identity, :school_name + json.extract! user, :id, :login, :real_name, :identity, :school_name, :hidden_phone end end \ No newline at end of file diff --git a/app/views/users/get_user_info.json.jbuilder b/app/views/users/get_user_info.json.jbuilder index e18ccfe05..06794b31e 100644 --- a/app/views/users/get_user_info.json.jbuilder +++ b/app/views/users/get_user_info.json.jbuilder @@ -4,6 +4,7 @@ json.login @user.login json.user_id @user.id json.image_url url_to_avatar(@user) json.admin @user.admin? +json.business @user.business? json.is_teacher @user.user_extension&.teacher? json.user_identity @user.identity json.tidding_count 0 diff --git a/app/views/weapps/code_sessions/create.json.jbuilder b/app/views/weapps/code_sessions/create.json.jbuilder new file mode 100644 index 000000000..280086948 --- /dev/null +++ b/app/views/weapps/code_sessions/create.json.jbuilder @@ -0,0 +1,3 @@ +json.user do + json.partial! 'weapps/shared/user', locals: { user: current_user } +end \ No newline at end of file diff --git a/app/views/weapps/sessions/create.json.jbuilder b/app/views/weapps/sessions/create.json.jbuilder new file mode 100644 index 000000000..280086948 --- /dev/null +++ b/app/views/weapps/sessions/create.json.jbuilder @@ -0,0 +1,3 @@ +json.user do + json.partial! 'weapps/shared/user', locals: { user: current_user } +end \ No newline at end of file diff --git a/app/views/weapps/shared/_user.json.jbuilder b/app/views/weapps/shared/_user.json.jbuilder new file mode 100644 index 000000000..be67384cc --- /dev/null +++ b/app/views/weapps/shared/_user.json.jbuilder @@ -0,0 +1,14 @@ +json.username user.full_name +json.real_name user.real_name +json.login user.login +json.user_id user.id +json.image_url url_to_avatar(user) +json.admin user.admin? +json.business user.business? +json.is_teacher user.user_extension&.teacher? +json.user_identity user.identity +json.tidding_count 0 +json.user_phone_binded user.phone.present? +json.phone user.phone +json.profile_completed user.profile_completed? +json.professional_certification user.professional_certification \ No newline at end of file diff --git a/config/locales/forms/save_team_form.zh-CN.yml b/config/locales/forms/save_team_form.zh-CN.yml index 106527687..7fc146d36 100644 --- a/config/locales/forms/save_team_form.zh-CN.yml +++ b/config/locales/forms/save_team_form.zh-CN.yml @@ -12,14 +12,15 @@ competitions/save_team_form: attributes: creator: + enrolled: "您已经报名过该竞赛了" teacher_enroll_forbidden: "本竞赛的参赛者限定为:学生" member_enroll_forbidden: "本竞赛的参赛者限定为:教师" teacher_ids: enroll_forbidden: "本竞赛的参赛者限定为:学生" invalid_count: "教师数量应为%{minimum}~%{maximum}人" - enrolled: "教师 ${names} 已加入其它战队了" + enrolled: "教师 %{names} 已加入其它战队了" member_ids: enroll_forbidden: "本竞赛的参赛者限定为:教师" invalid_count: "队员数量应为%{minimum}~%{maximum}人" - enrolled: "队员 ${names} 已加入其它战队了" + enrolled: "队员 %{names} 已加入其它战队了" diff --git a/config/routes.rb b/config/routes.rb index 80e1298cc..8bad9a889 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1025,6 +1025,7 @@ Rails.application.routes.draw do resources :competition_settings, only: [:index] do post :basic_setting, on: :collection + post :nav_setting, on: :collection end resources :enroll_lists, only: [:index] do diff --git a/db/migrate/20191023074837_migrate_competition_module_type.rb b/db/migrate/20191023074837_migrate_competition_module_type.rb index 009b65cc9..c98c5797d 100644 --- a/db/migrate/20191023074837_migrate_competition_module_type.rb +++ b/db/migrate/20191023074837_migrate_competition_module_type.rb @@ -16,7 +16,7 @@ class MigrateCompetitionModuleType < ActiveRecord::Migration[5.2] mod_type = "manual" when '排行榜' mod_type = "chart" - when '资料下载 ' + when '资料下载' mod_type = "resource" else mod_type = "md" diff --git a/db/migrate/20191024055404_migrate_com_module_resource.rb b/db/migrate/20191024055404_migrate_com_module_resource.rb new file mode 100644 index 000000000..f8625b2bc --- /dev/null +++ b/db/migrate/20191024055404_migrate_com_module_resource.rb @@ -0,0 +1,26 @@ +class MigrateComModuleResource < ActiveRecord::Migration[5.2] + def change + Competition.all.each do |competition| + competition.competition_modules.each do |com_module| + mod_type = "" + case com_module.name.strip + when '首页' + mod_type = "home" + when '报名' + mod_type = "enroll" + when '通知公告' + mod_type = "inform" + when '参赛手册' + mod_type = "manual" + when '排行榜' + mod_type = "chart" + when '资料下载' + mod_type = "resource" + else + mod_type = "md" + end + com_module.update_attributes!(module_type: mod_type) + end + end + end +end diff --git a/db/migrate/20191024075134_migrate_competition_module_manual.rb b/db/migrate/20191024075134_migrate_competition_module_manual.rb new file mode 100644 index 000000000..3a2f16cff --- /dev/null +++ b/db/migrate/20191024075134_migrate_competition_module_manual.rb @@ -0,0 +1,5 @@ +class MigrateCompetitionModuleManual < ActiveRecord::Migration[5.2] + def change + CompetitionModule.where(module_type: "manual").update_all(module_type: "md") + end +end diff --git a/db/migrate/20191024083706_migrate_competition_module_content.rb b/db/migrate/20191024083706_migrate_competition_module_content.rb new file mode 100644 index 000000000..72d023a38 --- /dev/null +++ b/db/migrate/20191024083706_migrate_competition_module_content.rb @@ -0,0 +1,17 @@ +class MigrateCompetitionModuleContent < ActiveRecord::Migration[5.2] + def change + Competition.all.each do |competition| + competition.informs.each do |inform| + if inform.status == 1 + com_module = competition.competition_modules.find_by(module_type: "inform") + elsif inform.status == 2 + com_module = competition.competition_modules.find_by(name: "参赛手册") + end + if com_module + new_md = CompetitionModuleMdContent.create!(competition_module_id: com_module.id, content: inform.description, name: inform.name) + Attachment.where(container_id: inform.id, container_type: "Inform").update_all(container_id: new_md.id, container_type: "CompetitionModuleMdContent") + end + end + end + end +end diff --git a/db/migrate/20191024090740_migrate_competition_chart_rules.rb b/db/migrate/20191024090740_migrate_competition_chart_rules.rb new file mode 100644 index 000000000..ed1dd56e9 --- /dev/null +++ b/db/migrate/20191024090740_migrate_competition_chart_rules.rb @@ -0,0 +1,14 @@ +class MigrateCompetitionChartRules < ActiveRecord::Migration[5.2] + def change + add_column :competition_module_md_contents, :competition_stage_id, :integer, default: 0 + + ChartRule.all.each do |rule| + if rule.competition + com_module = rule.competition.competition_modules.find_by(module_type: "chart") + if com_module + CompetitionModuleMdContent.create!(content: rule.content, competition_module_id: com_module.id, competition_stage_id: rule.competition_stage_id ? rule.competition_stage_id : 0) + end + end + end + end +end diff --git a/public/assets/.sprockets-manifest-4627fa5586ef7fed55ca286af7c028e9.json b/public/assets/.sprockets-manifest-4627fa5586ef7fed55ca286af7c028e9.json index 2404fbf37..153a05ce2 100644 --- a/public/assets/.sprockets-manifest-4627fa5586ef7fed55ca286af7c028e9.json +++ b/public/assets/.sprockets-manifest-4627fa5586ef7fed55ca286af7c028e9.json @@ -1 +1 @@ -{"files":{"admin-cd9ca8bacc973ce2dbace30c97f6c40bc08e2c2ee44972f668e738e1902c0121.js":{"logical_path":"admin.js","mtime":"2019-09-11T16:20:07+08:00","size":4350881,"digest":"cd9ca8bacc973ce2dbace30c97f6c40bc08e2c2ee44972f668e738e1902c0121","integrity":"sha256-zZyousyXPOLbrOMMl/bEC8COLC7kSXL2aOc44ZAsASE="},"admin-a1b3356efe50ff4717cf22475639b5333c5354ba03fd107c9b7a8d4ae76f47aa.css":{"logical_path":"admin.css","mtime":"2019-09-11T16:20:07+08:00","size":773445,"digest":"a1b3356efe50ff4717cf22475639b5333c5354ba03fd107c9b7a8d4ae76f47aa","integrity":"sha256-obM1bv5Q/0cXzyJHVjm1MzxTVLoD/RB8m3qNSudvR6o="},"font-awesome/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot":{"logical_path":"font-awesome/fontawesome-webfont.eot","mtime":"2019-08-14T17:22:43+08:00","size":165742,"digest":"7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979","integrity":"sha256-e/yrbbmdXPvxcFygU23ceFhUMsxfpBu9etDwCQM7KXk="},"font-awesome/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2":{"logical_path":"font-awesome/fontawesome-webfont.woff2","mtime":"2019-08-14T17:22:43+08:00","size":77160,"digest":"2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe","integrity":"sha256-Kt78vAQefRj88tQXh53FoJmXqmTWdbejxLbOM9oT8/4="},"font-awesome/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff":{"logical_path":"font-awesome/fontawesome-webfont.woff","mtime":"2019-08-14T17:22:43+08:00","size":98024,"digest":"ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07","integrity":"sha256-ugxZ3rVFD1y0Gz+TYJ7i0NmVQVh33foiPoqKdTNHTwc="},"font-awesome/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf":{"logical_path":"font-awesome/fontawesome-webfont.ttf","mtime":"2019-08-14T17:22:43+08:00","size":165548,"digest":"aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8","integrity":"sha256-qljzPyOaD7AvXHpsRcBD16msmgkzNYBmlOzW1O3A1qg="},"font-awesome/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg":{"logical_path":"font-awesome/fontawesome-webfont.svg","mtime":"2019-08-14T17:22:43+08:00","size":444379,"digest":"ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4","integrity":"sha256-rWFXkmwWIrpOHQPUePFUE2hSS/xG9R5C/g2UX37zI+Q="},"college-18f5e8400331634e898a35acc2187815c096c25e0ab74aba341ae916166cd287.js":{"logical_path":"college.js","mtime":"2019-10-17T09:44:58+08:00","size":3352744,"digest":"18f5e8400331634e898a35acc2187815c096c25e0ab74aba341ae916166cd287","integrity":"sha256-GPXoQAMxY06JijWswhh4FcCWwl4Kt0q6NBrpFhZs0oc="},"college-944d4273f62c7538368b9017fdd3387b5e3bea31a87873770eb231324546d4d9.css":{"logical_path":"college.css","mtime":"2019-09-11T16:20:07+08:00","size":546841,"digest":"944d4273f62c7538368b9017fdd3387b5e3bea31a87873770eb231324546d4d9","integrity":"sha256-lE1Cc/YsdTg2i5AX/dM4e1476jGoeHN3DrIxMkVG1Nk="},"logo-7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423.png":{"logical_path":"logo.png","mtime":"2019-09-03T08:55:53+08:00","size":2816,"digest":"7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423","integrity":"sha256-f/ESVocJv5f5iY/ockm3qPIA/x9I1TfYWvhyFfGHBCM="},"application-9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb.js":{"logical_path":"application.js","mtime":"2019-10-17T09:44:58+08:00","size":600706,"digest":"9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb","integrity":"sha256-nPvD15JZmh0N5ce4QgnhwrLmAzbw8B4Z8FgWY5GHCPs="},"application-5eb87c6e13676d0183317debce17fade27e68c4acee28c419438da15d53c94f2.css":{"logical_path":"application.css","mtime":"2019-09-11T16:20:07+08:00","size":1844002,"digest":"5eb87c6e13676d0183317debce17fade27e68c4acee28c419438da15d53c94f2","integrity":"sha256-Xrh8bhNnbQGDMX3rzhf63ifmjErO4oxBlDjaFdU8lPI="},"admin-c9e5ebe6191548550e27514196ea125cfbb402820ec125a0c9acf99d2d378fe4.js":{"logical_path":"admin.js","mtime":"2019-09-21T15:28:08+08:00","size":4382031,"digest":"c9e5ebe6191548550e27514196ea125cfbb402820ec125a0c9acf99d2d378fe4","integrity":"sha256-yeXr5hkVSFUOJ1FBluoSXPu0AoIOwSWgyaz5nS03j+Q="},"admin-59c59f8cae8bef4a8359286c985458110c9d03ea121516595c988943f4717c38.css":{"logical_path":"admin.css","mtime":"2019-09-21T14:49:04+08:00","size":840093,"digest":"59c59f8cae8bef4a8359286c985458110c9d03ea121516595c988943f4717c38","integrity":"sha256-WcWfjK6L70qDWShsmFRYEQydA+oSFRZZXJiJQ/RxfDg="},"college-38f953d6ba5b85d3fab63cb3c2bbf0d057ccc6454d07cfaafac3b06da37b8437.css":{"logical_path":"college.css","mtime":"2019-09-16T13:56:09+08:00","size":579109,"digest":"38f953d6ba5b85d3fab63cb3c2bbf0d057ccc6454d07cfaafac3b06da37b8437","integrity":"sha256-OPlT1rpbhdP6tjyzwrvw0FfMxkVNB8+q+sOwbaN7hDc="},"application-646b1158a4e8c1f13e684d6fe9025abc75f8d3ba5256e440802c0398223374f3.css":{"logical_path":"application.css","mtime":"2019-09-21T14:49:04+08:00","size":1988767,"digest":"646b1158a4e8c1f13e684d6fe9025abc75f8d3ba5256e440802c0398223374f3","integrity":"sha256-ZGsRWKTowfE+aE1v6QJavHX407pSVuRAgCwDmCIzdPM="},"admin-a47e37c0ec7cf5f22380249776d1e82d65b6b6aa272ed7389185aa200fa40751.js":{"logical_path":"admin.js","mtime":"2019-09-25T15:33:05+08:00","size":4383107,"digest":"a47e37c0ec7cf5f22380249776d1e82d65b6b6aa272ed7389185aa200fa40751","integrity":"sha256-pH43wOx89fIjgCSXdtHoLWW2tqonLtc4kYWqIA+kB1E="},"admin-432c4eac09b036c57ff1e88d902b8aa7df81164e4b419bac557cf1366c1d3ad9.js":{"logical_path":"admin.js","mtime":"2019-09-25T15:35:20+08:00","size":4383103,"digest":"432c4eac09b036c57ff1e88d902b8aa7df81164e4b419bac557cf1366c1d3ad9","integrity":"sha256-QyxOrAmwNsV/8eiNkCuKp9+BFk5LQZusVXzxNmwdOtk="},"admin-978e5ce607f77c26814a174f480da79ac246c2201868ef84654aa03bb6727b5a.js":{"logical_path":"admin.js","mtime":"2019-09-30T14:43:41+08:00","size":4387200,"digest":"978e5ce607f77c26814a174f480da79ac246c2201868ef84654aa03bb6727b5a","integrity":"sha256-l45c5gf3fCaBShdPSA2nmsJGwiAYaO+EZUqgO7Zye1o="},"admin-896281f4731722b0c084dbb1af21d0f34a5bc142d58aff57b391864ab71ddca7.css":{"logical_path":"admin.css","mtime":"2019-09-30T14:43:41+08:00","size":842269,"digest":"896281f4731722b0c084dbb1af21d0f34a5bc142d58aff57b391864ab71ddca7","integrity":"sha256-iWKB9HMXIrDAhNuxryHQ80pbwULViv9Xs5GGSrcd3Kc="},"application-97f313e9bb7d25476649f7d7215959cf421480fd0a3785d1956953bf94a1e8bd.css":{"logical_path":"application.css","mtime":"2019-09-30T14:43:41+08:00","size":1993118,"digest":"97f313e9bb7d25476649f7d7215959cf421480fd0a3785d1956953bf94a1e8bd","integrity":"sha256-l/MT6bt9JUdmSffXIVlZz0IUgP0KN4XRlWlTv5Sh6L0="},"admin-2cdb23442fa735025385b88f2900df04fef38b61530041a6dbe375ef0f0ae888.js":{"logical_path":"admin.js","mtime":"2019-10-11T14:38:33+08:00","size":4394616,"digest":"2cdb23442fa735025385b88f2900df04fef38b61530041a6dbe375ef0f0ae888","integrity":"sha256-LNsjRC+nNQJThbiPKQDfBP7zi2FTAEGm2+N17w8K6Ig="},"admin-2c2854b9a02158ded5a809aaf7144a8630b10354ab4e56fecc4dffcc713796cc.css":{"logical_path":"admin.css","mtime":"2019-10-10T17:12:05+08:00","size":846514,"digest":"2c2854b9a02158ded5a809aaf7144a8630b10354ab4e56fecc4dffcc713796cc","integrity":"sha256-LChUuaAhWN7VqAmq9xRKhjCxA1SrTlb+zE3/zHE3lsw="},"application-50059ae929866043b47015128702fcfba53d32a2df148e64e1d961c10651c6af.css":{"logical_path":"application.css","mtime":"2019-10-10T17:12:05+08:00","size":2001607,"digest":"50059ae929866043b47015128702fcfba53d32a2df148e64e1d961c10651c6af","integrity":"sha256-UAWa6SmGYEO0cBUShwL8+6U9MqLfFI5k4dlhwQZRxq8="},"admin-992cde09b6d17f00a49576ae2d9f1ced127244ba401ef5b7d677cab9741688d2.js":{"logical_path":"admin.js","mtime":"2019-10-16T16:11:32+08:00","size":4394790,"digest":"992cde09b6d17f00a49576ae2d9f1ced127244ba401ef5b7d677cab9741688d2","integrity":"sha256-mSzeCbbRfwCklXauLZ8c7RJyRLpAHvW31nfKuXQWiNI="},"admin-84f2a7791e275d6f820514370b3f968176b994b9dd7b8c3ba8bf48336b03f257.css":{"logical_path":"admin.css","mtime":"2019-10-16T19:25:40+08:00","size":846676,"digest":"84f2a7791e275d6f820514370b3f968176b994b9dd7b8c3ba8bf48336b03f257","integrity":"sha256-hPKneR4nXW+CBRQ3Cz+WgXa5lLnde4w7qL9IM2sD8lc="},"application-ef6bab84852baaf69a91fe6af875b6e1b118c55b4c7d165665c488fac80c4997.css":{"logical_path":"application.css","mtime":"2019-10-16T19:25:40+08:00","size":2001931,"digest":"ef6bab84852baaf69a91fe6af875b6e1b118c55b4c7d165665c488fac80c4997","integrity":"sha256-72urhIUrqvaakf5q+HW24bEYxVtMfRZWZcSI+sgMSZc="},"admin-c99030d305662f740aa84b6c925a1adbbaadaa07fd74e2655e64d44b4b97fc4a.js":{"logical_path":"admin.js","mtime":"2019-10-17T09:44:58+08:00","size":4394897,"digest":"c99030d305662f740aa84b6c925a1adbbaadaa07fd74e2655e64d44b4b97fc4a","integrity":"sha256-yZAw0wVmL3QKqEtskloa27qtqgf9dOJlXmTUS0uX/Eo="},"admin-534bde871d67f4d6fc8da611917d78be4066fc7593ba53ee92aa17068a199d6d.css":{"logical_path":"admin.css","mtime":"2019-10-17T10:22:41+08:00","size":846699,"digest":"534bde871d67f4d6fc8da611917d78be4066fc7593ba53ee92aa17068a199d6d","integrity":"sha256-U0vehx1n9Nb8jaYRkX14vkBm/HWTulPukqoXBooZnW0="},"cooperative-04cd6a60d41220d38ee45ce40b1d004e1d0bcd87c132fb1a7bab6144c1deb8d7.js":{"logical_path":"cooperative.js","mtime":"2019-10-17T10:17:56+08:00","size":4330072,"digest":"04cd6a60d41220d38ee45ce40b1d004e1d0bcd87c132fb1a7bab6144c1deb8d7","integrity":"sha256-BM1qYNQSINOO5FzkCx0ATh0LzYfBMvsae6thRMHeuNc="},"cooperative-a345bbfd8e38b70c9285ecc1747012ffcde429187983e2aea5657abb56b9b4f3.css":{"logical_path":"cooperative.css","mtime":"2019-10-17T10:21:41+08:00","size":830628,"digest":"a345bbfd8e38b70c9285ecc1747012ffcde429187983e2aea5657abb56b9b4f3","integrity":"sha256-o0W7/Y44twyShezBdHAS/83kKRh5g+KupWV6u1a5tPM="},"application-0e417478d56f42467e857cd186b29cbbc0d6c7c6e85c8a6f42f39ac618943de8.css":{"logical_path":"application.css","mtime":"2019-09-03T08:55:53+08:00","size":442932,"digest":"0e417478d56f42467e857cd186b29cbbc0d6c7c6e85c8a6f42f39ac618943de8","integrity":"sha256-DkF0eNVvQkZ+hXzRhrKcu8DWx8boXIpvQvOaxhiUPeg="},"cooperative-149f47b8675d60a8014ccff50f00f932ff69e2be286ffb74343bc4a3effb135b.js":{"logical_path":"cooperative.js","mtime":"2019-10-17T14:03:03+08:00","size":4338033,"digest":"149f47b8675d60a8014ccff50f00f932ff69e2be286ffb74343bc4a3effb135b","integrity":"sha256-FJ9HuGddYKgBTM/1DwD5Mv9p4r4ob/t0NDvEo+/7E1s="},"cooperative-6273b766d6ef11dd56174d868bab55e7f17af17546c888d2ba0dd0a6bcda76c8.css":{"logical_path":"cooperative.css","mtime":"2019-10-17T11:13:07+08:00","size":832914,"digest":"6273b766d6ef11dd56174d868bab55e7f17af17546c888d2ba0dd0a6bcda76c8","integrity":"sha256-YnO3ZtbvEd1WF02Gi6tV5/F68XVGyIjSug3Qprzadsg="},"admin-82f66cc80b5649c6530a562567f28fe8d05f7bc3b8221e0695b2216255c52ba6.js":{"logical_path":"admin.js","mtime":"2019-10-21T13:51:43+08:00","size":4397012,"digest":"82f66cc80b5649c6530a562567f28fe8d05f7bc3b8221e0695b2216255c52ba6","integrity":"sha256-gvZsyAtWScZTClYlZ/KP6NBfe8O4Ih4GlbIhYlXFK6Y="},"admin-1b5728d94f6bccfbcef452a760d94c3b6f31966bc65d7f89be077fc2ea512bec.js":{"logical_path":"admin.js","mtime":"2019-10-21T16:41:06+08:00","size":4397437,"digest":"1b5728d94f6bccfbcef452a760d94c3b6f31966bc65d7f89be077fc2ea512bec","integrity":"sha256-G1co2U9rzPvO9FKnYNlMO28xlmvGXX+Jvgd/wupRK+w="},"admin-c8c127fefa5eca98bca19832c246619318164e8f242635c07033e2423cc18a6f.js":{"logical_path":"admin.js","mtime":"2019-10-22T09:53:29+08:00","size":4408150,"digest":"c8c127fefa5eca98bca19832c246619318164e8f242635c07033e2423cc18a6f","integrity":"sha256-yMEn/vpeypi8oZgywkZhkxgWTo8kJjXAcDPiQjzBim8="},"admin-60d200c1fcdf61a60537d29ccf4479c6b1e5e904208870a63b8ee677c96b347e.css":{"logical_path":"admin.css","mtime":"2019-10-22T09:43:20+08:00","size":851150,"digest":"60d200c1fcdf61a60537d29ccf4479c6b1e5e904208870a63b8ee677c96b347e","integrity":"sha256-YNIAwfzfYaYFN9Kcz0R5xrHl6QQgiHCmO47md8lrNH4="},"cooperative-9fb7ac4ad44081fafd5ad2a3a1bfb7f4329ac96f28bc6446d1ff52b1e2e71286.js":{"logical_path":"cooperative.js","mtime":"2019-10-22T09:55:26+08:00","size":4338142,"digest":"9fb7ac4ad44081fafd5ad2a3a1bfb7f4329ac96f28bc6446d1ff52b1e2e71286","integrity":"sha256-n7esStRAgfr9WtKjob+39DKayW8ovGRG0f9SseLnEoY="}},"assets":{"admin.js":"admin-c8c127fefa5eca98bca19832c246619318164e8f242635c07033e2423cc18a6f.js","admin.css":"admin-60d200c1fcdf61a60537d29ccf4479c6b1e5e904208870a63b8ee677c96b347e.css","font-awesome/fontawesome-webfont.eot":"font-awesome/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot","font-awesome/fontawesome-webfont.woff2":"font-awesome/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2","font-awesome/fontawesome-webfont.woff":"font-awesome/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff","font-awesome/fontawesome-webfont.ttf":"font-awesome/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf","font-awesome/fontawesome-webfont.svg":"font-awesome/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg","college.js":"college-18f5e8400331634e898a35acc2187815c096c25e0ab74aba341ae916166cd287.js","college.css":"college-38f953d6ba5b85d3fab63cb3c2bbf0d057ccc6454d07cfaafac3b06da37b8437.css","logo.png":"logo-7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423.png","application.js":"application-9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb.js","application.css":"application-0e417478d56f42467e857cd186b29cbbc0d6c7c6e85c8a6f42f39ac618943de8.css","cooperative.js":"cooperative-9fb7ac4ad44081fafd5ad2a3a1bfb7f4329ac96f28bc6446d1ff52b1e2e71286.js","cooperative.css":"cooperative-6273b766d6ef11dd56174d868bab55e7f17af17546c888d2ba0dd0a6bcda76c8.css"}} \ No newline at end of file +{"files":{"admin-cd9ca8bacc973ce2dbace30c97f6c40bc08e2c2ee44972f668e738e1902c0121.js":{"logical_path":"admin.js","mtime":"2019-09-11T16:20:07+08:00","size":4350881,"digest":"cd9ca8bacc973ce2dbace30c97f6c40bc08e2c2ee44972f668e738e1902c0121","integrity":"sha256-zZyousyXPOLbrOMMl/bEC8COLC7kSXL2aOc44ZAsASE="},"admin-a1b3356efe50ff4717cf22475639b5333c5354ba03fd107c9b7a8d4ae76f47aa.css":{"logical_path":"admin.css","mtime":"2019-09-11T16:20:07+08:00","size":773445,"digest":"a1b3356efe50ff4717cf22475639b5333c5354ba03fd107c9b7a8d4ae76f47aa","integrity":"sha256-obM1bv5Q/0cXzyJHVjm1MzxTVLoD/RB8m3qNSudvR6o="},"font-awesome/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot":{"logical_path":"font-awesome/fontawesome-webfont.eot","mtime":"2019-08-14T17:22:43+08:00","size":165742,"digest":"7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979","integrity":"sha256-e/yrbbmdXPvxcFygU23ceFhUMsxfpBu9etDwCQM7KXk="},"font-awesome/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2":{"logical_path":"font-awesome/fontawesome-webfont.woff2","mtime":"2019-08-14T17:22:43+08:00","size":77160,"digest":"2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe","integrity":"sha256-Kt78vAQefRj88tQXh53FoJmXqmTWdbejxLbOM9oT8/4="},"font-awesome/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff":{"logical_path":"font-awesome/fontawesome-webfont.woff","mtime":"2019-08-14T17:22:43+08:00","size":98024,"digest":"ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07","integrity":"sha256-ugxZ3rVFD1y0Gz+TYJ7i0NmVQVh33foiPoqKdTNHTwc="},"font-awesome/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf":{"logical_path":"font-awesome/fontawesome-webfont.ttf","mtime":"2019-08-14T17:22:43+08:00","size":165548,"digest":"aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8","integrity":"sha256-qljzPyOaD7AvXHpsRcBD16msmgkzNYBmlOzW1O3A1qg="},"font-awesome/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg":{"logical_path":"font-awesome/fontawesome-webfont.svg","mtime":"2019-08-14T17:22:43+08:00","size":444379,"digest":"ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4","integrity":"sha256-rWFXkmwWIrpOHQPUePFUE2hSS/xG9R5C/g2UX37zI+Q="},"college-18f5e8400331634e898a35acc2187815c096c25e0ab74aba341ae916166cd287.js":{"logical_path":"college.js","mtime":"2019-10-24T15:25:17+08:00","size":3352744,"digest":"18f5e8400331634e898a35acc2187815c096c25e0ab74aba341ae916166cd287","integrity":"sha256-GPXoQAMxY06JijWswhh4FcCWwl4Kt0q6NBrpFhZs0oc="},"college-944d4273f62c7538368b9017fdd3387b5e3bea31a87873770eb231324546d4d9.css":{"logical_path":"college.css","mtime":"2019-09-11T16:20:07+08:00","size":546841,"digest":"944d4273f62c7538368b9017fdd3387b5e3bea31a87873770eb231324546d4d9","integrity":"sha256-lE1Cc/YsdTg2i5AX/dM4e1476jGoeHN3DrIxMkVG1Nk="},"logo-7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423.png":{"logical_path":"logo.png","mtime":"2019-09-03T08:55:53+08:00","size":2816,"digest":"7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423","integrity":"sha256-f/ESVocJv5f5iY/ockm3qPIA/x9I1TfYWvhyFfGHBCM="},"application-9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb.js":{"logical_path":"application.js","mtime":"2019-10-24T15:25:17+08:00","size":600706,"digest":"9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb","integrity":"sha256-nPvD15JZmh0N5ce4QgnhwrLmAzbw8B4Z8FgWY5GHCPs="},"application-5eb87c6e13676d0183317debce17fade27e68c4acee28c419438da15d53c94f2.css":{"logical_path":"application.css","mtime":"2019-09-11T16:20:07+08:00","size":1844002,"digest":"5eb87c6e13676d0183317debce17fade27e68c4acee28c419438da15d53c94f2","integrity":"sha256-Xrh8bhNnbQGDMX3rzhf63ifmjErO4oxBlDjaFdU8lPI="},"admin-c9e5ebe6191548550e27514196ea125cfbb402820ec125a0c9acf99d2d378fe4.js":{"logical_path":"admin.js","mtime":"2019-09-21T15:28:08+08:00","size":4382031,"digest":"c9e5ebe6191548550e27514196ea125cfbb402820ec125a0c9acf99d2d378fe4","integrity":"sha256-yeXr5hkVSFUOJ1FBluoSXPu0AoIOwSWgyaz5nS03j+Q="},"admin-59c59f8cae8bef4a8359286c985458110c9d03ea121516595c988943f4717c38.css":{"logical_path":"admin.css","mtime":"2019-09-21T14:49:04+08:00","size":840093,"digest":"59c59f8cae8bef4a8359286c985458110c9d03ea121516595c988943f4717c38","integrity":"sha256-WcWfjK6L70qDWShsmFRYEQydA+oSFRZZXJiJQ/RxfDg="},"college-38f953d6ba5b85d3fab63cb3c2bbf0d057ccc6454d07cfaafac3b06da37b8437.css":{"logical_path":"college.css","mtime":"2019-09-16T13:56:09+08:00","size":579109,"digest":"38f953d6ba5b85d3fab63cb3c2bbf0d057ccc6454d07cfaafac3b06da37b8437","integrity":"sha256-OPlT1rpbhdP6tjyzwrvw0FfMxkVNB8+q+sOwbaN7hDc="},"application-646b1158a4e8c1f13e684d6fe9025abc75f8d3ba5256e440802c0398223374f3.css":{"logical_path":"application.css","mtime":"2019-09-21T14:49:04+08:00","size":1988767,"digest":"646b1158a4e8c1f13e684d6fe9025abc75f8d3ba5256e440802c0398223374f3","integrity":"sha256-ZGsRWKTowfE+aE1v6QJavHX407pSVuRAgCwDmCIzdPM="},"admin-a47e37c0ec7cf5f22380249776d1e82d65b6b6aa272ed7389185aa200fa40751.js":{"logical_path":"admin.js","mtime":"2019-09-25T15:33:05+08:00","size":4383107,"digest":"a47e37c0ec7cf5f22380249776d1e82d65b6b6aa272ed7389185aa200fa40751","integrity":"sha256-pH43wOx89fIjgCSXdtHoLWW2tqonLtc4kYWqIA+kB1E="},"admin-432c4eac09b036c57ff1e88d902b8aa7df81164e4b419bac557cf1366c1d3ad9.js":{"logical_path":"admin.js","mtime":"2019-09-25T15:35:20+08:00","size":4383103,"digest":"432c4eac09b036c57ff1e88d902b8aa7df81164e4b419bac557cf1366c1d3ad9","integrity":"sha256-QyxOrAmwNsV/8eiNkCuKp9+BFk5LQZusVXzxNmwdOtk="},"admin-978e5ce607f77c26814a174f480da79ac246c2201868ef84654aa03bb6727b5a.js":{"logical_path":"admin.js","mtime":"2019-09-30T14:43:41+08:00","size":4387200,"digest":"978e5ce607f77c26814a174f480da79ac246c2201868ef84654aa03bb6727b5a","integrity":"sha256-l45c5gf3fCaBShdPSA2nmsJGwiAYaO+EZUqgO7Zye1o="},"admin-896281f4731722b0c084dbb1af21d0f34a5bc142d58aff57b391864ab71ddca7.css":{"logical_path":"admin.css","mtime":"2019-09-30T14:43:41+08:00","size":842269,"digest":"896281f4731722b0c084dbb1af21d0f34a5bc142d58aff57b391864ab71ddca7","integrity":"sha256-iWKB9HMXIrDAhNuxryHQ80pbwULViv9Xs5GGSrcd3Kc="},"application-97f313e9bb7d25476649f7d7215959cf421480fd0a3785d1956953bf94a1e8bd.css":{"logical_path":"application.css","mtime":"2019-09-30T14:43:41+08:00","size":1993118,"digest":"97f313e9bb7d25476649f7d7215959cf421480fd0a3785d1956953bf94a1e8bd","integrity":"sha256-l/MT6bt9JUdmSffXIVlZz0IUgP0KN4XRlWlTv5Sh6L0="},"admin-2cdb23442fa735025385b88f2900df04fef38b61530041a6dbe375ef0f0ae888.js":{"logical_path":"admin.js","mtime":"2019-10-11T14:38:33+08:00","size":4394616,"digest":"2cdb23442fa735025385b88f2900df04fef38b61530041a6dbe375ef0f0ae888","integrity":"sha256-LNsjRC+nNQJThbiPKQDfBP7zi2FTAEGm2+N17w8K6Ig="},"admin-2c2854b9a02158ded5a809aaf7144a8630b10354ab4e56fecc4dffcc713796cc.css":{"logical_path":"admin.css","mtime":"2019-10-10T17:12:05+08:00","size":846514,"digest":"2c2854b9a02158ded5a809aaf7144a8630b10354ab4e56fecc4dffcc713796cc","integrity":"sha256-LChUuaAhWN7VqAmq9xRKhjCxA1SrTlb+zE3/zHE3lsw="},"application-50059ae929866043b47015128702fcfba53d32a2df148e64e1d961c10651c6af.css":{"logical_path":"application.css","mtime":"2019-10-10T17:12:05+08:00","size":2001607,"digest":"50059ae929866043b47015128702fcfba53d32a2df148e64e1d961c10651c6af","integrity":"sha256-UAWa6SmGYEO0cBUShwL8+6U9MqLfFI5k4dlhwQZRxq8="},"admin-992cde09b6d17f00a49576ae2d9f1ced127244ba401ef5b7d677cab9741688d2.js":{"logical_path":"admin.js","mtime":"2019-10-16T16:11:32+08:00","size":4394790,"digest":"992cde09b6d17f00a49576ae2d9f1ced127244ba401ef5b7d677cab9741688d2","integrity":"sha256-mSzeCbbRfwCklXauLZ8c7RJyRLpAHvW31nfKuXQWiNI="},"admin-84f2a7791e275d6f820514370b3f968176b994b9dd7b8c3ba8bf48336b03f257.css":{"logical_path":"admin.css","mtime":"2019-10-16T19:25:40+08:00","size":846676,"digest":"84f2a7791e275d6f820514370b3f968176b994b9dd7b8c3ba8bf48336b03f257","integrity":"sha256-hPKneR4nXW+CBRQ3Cz+WgXa5lLnde4w7qL9IM2sD8lc="},"application-ef6bab84852baaf69a91fe6af875b6e1b118c55b4c7d165665c488fac80c4997.css":{"logical_path":"application.css","mtime":"2019-10-16T19:25:40+08:00","size":2001931,"digest":"ef6bab84852baaf69a91fe6af875b6e1b118c55b4c7d165665c488fac80c4997","integrity":"sha256-72urhIUrqvaakf5q+HW24bEYxVtMfRZWZcSI+sgMSZc="},"admin-c99030d305662f740aa84b6c925a1adbbaadaa07fd74e2655e64d44b4b97fc4a.js":{"logical_path":"admin.js","mtime":"2019-10-17T09:44:58+08:00","size":4394897,"digest":"c99030d305662f740aa84b6c925a1adbbaadaa07fd74e2655e64d44b4b97fc4a","integrity":"sha256-yZAw0wVmL3QKqEtskloa27qtqgf9dOJlXmTUS0uX/Eo="},"admin-534bde871d67f4d6fc8da611917d78be4066fc7593ba53ee92aa17068a199d6d.css":{"logical_path":"admin.css","mtime":"2019-10-17T10:22:41+08:00","size":846699,"digest":"534bde871d67f4d6fc8da611917d78be4066fc7593ba53ee92aa17068a199d6d","integrity":"sha256-U0vehx1n9Nb8jaYRkX14vkBm/HWTulPukqoXBooZnW0="},"cooperative-04cd6a60d41220d38ee45ce40b1d004e1d0bcd87c132fb1a7bab6144c1deb8d7.js":{"logical_path":"cooperative.js","mtime":"2019-10-17T10:17:56+08:00","size":4330072,"digest":"04cd6a60d41220d38ee45ce40b1d004e1d0bcd87c132fb1a7bab6144c1deb8d7","integrity":"sha256-BM1qYNQSINOO5FzkCx0ATh0LzYfBMvsae6thRMHeuNc="},"cooperative-a345bbfd8e38b70c9285ecc1747012ffcde429187983e2aea5657abb56b9b4f3.css":{"logical_path":"cooperative.css","mtime":"2019-10-17T10:21:41+08:00","size":830628,"digest":"a345bbfd8e38b70c9285ecc1747012ffcde429187983e2aea5657abb56b9b4f3","integrity":"sha256-o0W7/Y44twyShezBdHAS/83kKRh5g+KupWV6u1a5tPM="},"application-0e417478d56f42467e857cd186b29cbbc0d6c7c6e85c8a6f42f39ac618943de8.css":{"logical_path":"application.css","mtime":"2019-09-03T08:55:53+08:00","size":442932,"digest":"0e417478d56f42467e857cd186b29cbbc0d6c7c6e85c8a6f42f39ac618943de8","integrity":"sha256-DkF0eNVvQkZ+hXzRhrKcu8DWx8boXIpvQvOaxhiUPeg="},"cooperative-149f47b8675d60a8014ccff50f00f932ff69e2be286ffb74343bc4a3effb135b.js":{"logical_path":"cooperative.js","mtime":"2019-10-17T14:03:03+08:00","size":4338033,"digest":"149f47b8675d60a8014ccff50f00f932ff69e2be286ffb74343bc4a3effb135b","integrity":"sha256-FJ9HuGddYKgBTM/1DwD5Mv9p4r4ob/t0NDvEo+/7E1s="},"cooperative-6273b766d6ef11dd56174d868bab55e7f17af17546c888d2ba0dd0a6bcda76c8.css":{"logical_path":"cooperative.css","mtime":"2019-10-17T11:13:07+08:00","size":832914,"digest":"6273b766d6ef11dd56174d868bab55e7f17af17546c888d2ba0dd0a6bcda76c8","integrity":"sha256-YnO3ZtbvEd1WF02Gi6tV5/F68XVGyIjSug3Qprzadsg="},"admin-82f66cc80b5649c6530a562567f28fe8d05f7bc3b8221e0695b2216255c52ba6.js":{"logical_path":"admin.js","mtime":"2019-10-21T13:51:43+08:00","size":4397012,"digest":"82f66cc80b5649c6530a562567f28fe8d05f7bc3b8221e0695b2216255c52ba6","integrity":"sha256-gvZsyAtWScZTClYlZ/KP6NBfe8O4Ih4GlbIhYlXFK6Y="},"admin-1b5728d94f6bccfbcef452a760d94c3b6f31966bc65d7f89be077fc2ea512bec.js":{"logical_path":"admin.js","mtime":"2019-10-21T16:41:06+08:00","size":4397437,"digest":"1b5728d94f6bccfbcef452a760d94c3b6f31966bc65d7f89be077fc2ea512bec","integrity":"sha256-G1co2U9rzPvO9FKnYNlMO28xlmvGXX+Jvgd/wupRK+w="},"admin-c8c127fefa5eca98bca19832c246619318164e8f242635c07033e2423cc18a6f.js":{"logical_path":"admin.js","mtime":"2019-10-22T09:53:29+08:00","size":4408150,"digest":"c8c127fefa5eca98bca19832c246619318164e8f242635c07033e2423cc18a6f","integrity":"sha256-yMEn/vpeypi8oZgywkZhkxgWTo8kJjXAcDPiQjzBim8="},"admin-60d200c1fcdf61a60537d29ccf4479c6b1e5e904208870a63b8ee677c96b347e.css":{"logical_path":"admin.css","mtime":"2019-10-22T09:43:20+08:00","size":851150,"digest":"60d200c1fcdf61a60537d29ccf4479c6b1e5e904208870a63b8ee677c96b347e","integrity":"sha256-YNIAwfzfYaYFN9Kcz0R5xrHl6QQgiHCmO47md8lrNH4="},"cooperative-9fb7ac4ad44081fafd5ad2a3a1bfb7f4329ac96f28bc6446d1ff52b1e2e71286.js":{"logical_path":"cooperative.js","mtime":"2019-10-22T09:55:26+08:00","size":4338142,"digest":"9fb7ac4ad44081fafd5ad2a3a1bfb7f4329ac96f28bc6446d1ff52b1e2e71286","integrity":"sha256-n7esStRAgfr9WtKjob+39DKayW8ovGRG0f9SseLnEoY="},"admin-a11066081d60365ddf25d5867560d1ccdd3197dbe82a5b6e969cc940e3429ff1.js":{"logical_path":"admin.js","mtime":"2019-10-24T14:16:30+08:00","size":4524252,"digest":"a11066081d60365ddf25d5867560d1ccdd3197dbe82a5b6e969cc940e3429ff1","integrity":"sha256-oRBmCB1gNl3fJdWGdWDRzN0xl9voKltulpzJQONCn/E="},"admin-7ce3dd717f7d12fcbc64caf14200230a1e68db439be0ba1879077599ff2c32c6.css":{"logical_path":"admin.css","mtime":"2019-10-24T10:10:08+08:00","size":852772,"digest":"7ce3dd717f7d12fcbc64caf14200230a1e68db439be0ba1879077599ff2c32c6","integrity":"sha256-fOPdcX99Evy8ZMrxQgAjCh5o20Ob4LoYeQd1mf8sMsY="},"college-93904c65d52c125aec0a463b9fd98bedda0018b78707f806be22685cca5d3747.css":{"logical_path":"college.css","mtime":"2019-10-24T10:10:08+08:00","size":579546,"digest":"93904c65d52c125aec0a463b9fd98bedda0018b78707f806be22685cca5d3747","integrity":"sha256-k5BMZdUsElrsCkY7n9mL7doAGLeHB/gGviJoXMpdN0c="},"cooperative-84c79d26a36aff5b496551b6d21b1bfb726b1bbc4153435a366115e96c204e06.js":{"logical_path":"cooperative.js","mtime":"2019-10-24T14:17:15+08:00","size":4338225,"digest":"84c79d26a36aff5b496551b6d21b1bfb726b1bbc4153435a366115e96c204e06","integrity":"sha256-hMedJqNq/1tJZVG20hsb+3JrG7xBU0NaNmEV6WwgTgY="},"cooperative-10a9ee5177e196572573ccea460e133c748072e223fdb473d05ee72c991fbbe3.css":{"logical_path":"cooperative.css","mtime":"2019-10-24T10:10:08+08:00","size":833351,"digest":"10a9ee5177e196572573ccea460e133c748072e223fdb473d05ee72c991fbbe3","integrity":"sha256-EKnuUXfhllclc8zqRg4TPHSAcuIj/bRz0F7nLJkfu+M="},"admin-441d8f3722e5f73e5748aaeb6f517101474cb1eb48a99f119e561f08b9e9dc60.js":{"logical_path":"admin.js","mtime":"2019-10-24T16:08:56+08:00","size":4525031,"digest":"441d8f3722e5f73e5748aaeb6f517101474cb1eb48a99f119e561f08b9e9dc60","integrity":"sha256-RB2PNyLl9z5XSKrrb1FxAUdMsetIqZ8RnlYfCLnp3GA="},"admin-76c52986591f274f639ad48dfbb480a1aeeec7647b6fa28fa541e78a064b6316.css":{"logical_path":"admin.css","mtime":"2019-10-24T15:25:17+08:00","size":867945,"digest":"76c52986591f274f639ad48dfbb480a1aeeec7647b6fa28fa541e78a064b6316","integrity":"sha256-dsUphlkfJ09jmtSN+7SAoa7ux2R7b6KPpUHnigZLYxY="},"cooperative-6c4c663b6b5071535bab2b76cc5e05ab5682665857763a76bf4f01afef51be5a.js":{"logical_path":"cooperative.js","mtime":"2019-10-24T15:25:17+08:00","size":4339039,"digest":"6c4c663b6b5071535bab2b76cc5e05ab5682665857763a76bf4f01afef51be5a","integrity":"sha256-bExmO2tQcVNbqyt2zF4Fq1aCZlhXdjp2v08Br+9Rvlo="}},"assets":{"admin.js":"admin-441d8f3722e5f73e5748aaeb6f517101474cb1eb48a99f119e561f08b9e9dc60.js","admin.css":"admin-76c52986591f274f639ad48dfbb480a1aeeec7647b6fa28fa541e78a064b6316.css","font-awesome/fontawesome-webfont.eot":"font-awesome/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot","font-awesome/fontawesome-webfont.woff2":"font-awesome/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2","font-awesome/fontawesome-webfont.woff":"font-awesome/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff","font-awesome/fontawesome-webfont.ttf":"font-awesome/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf","font-awesome/fontawesome-webfont.svg":"font-awesome/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg","college.js":"college-18f5e8400331634e898a35acc2187815c096c25e0ab74aba341ae916166cd287.js","college.css":"college-93904c65d52c125aec0a463b9fd98bedda0018b78707f806be22685cca5d3747.css","logo.png":"logo-7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423.png","application.js":"application-9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb.js","application.css":"application-0e417478d56f42467e857cd186b29cbbc0d6c7c6e85c8a6f42f39ac618943de8.css","cooperative.js":"cooperative-6c4c663b6b5071535bab2b76cc5e05ab5682665857763a76bf4f01afef51be5a.js","cooperative.css":"cooperative-10a9ee5177e196572573ccea460e133c748072e223fdb473d05ee72c991fbbe3.css"}} \ No newline at end of file diff --git a/public/assets/admin-c8c127fefa5eca98bca19832c246619318164e8f242635c07033e2423cc18a6f.js b/public/assets/admin-441d8f3722e5f73e5748aaeb6f517101474cb1eb48a99f119e561f08b9e9dc60.js similarity index 97% rename from public/assets/admin-c8c127fefa5eca98bca19832c246619318164e8f242635c07033e2423cc18a6f.js rename to public/assets/admin-441d8f3722e5f73e5748aaeb6f517101474cb1eb48a99f119e561f08b9e9dc60.js index bbc2ec400..0ebd4eb4a 100644 --- a/public/assets/admin-c8c127fefa5eca98bca19832c246619318164e8f242635c07033e2423cc18a6f.js +++ b/public/assets/admin-441d8f3722e5f73e5748aaeb6f517101474cb1eb48a99f119e561f08b9e9dc60.js @@ -25117,6 +25117,13 @@ S2.define('jquery.select2',[ // Return the Select2 instance for anyone who is importing it. return select2; })); +//! moment.js +//! version : 2.10.6 +//! authors : Tim Wood, Iskren Chernev, Moment.js contributors +//! license : MIT +//! momentjs.com +!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return Hc.apply(null,arguments)}function b(a){Hc=a}function c(a){return"[object Array]"===Object.prototype.toString.call(a)}function d(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function e(a,b){var c,d=[];for(c=0;c0)for(c in Jc)d=Jc[c],e=b[d],"undefined"!=typeof e&&(a[d]=e);return a}function n(b){m(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),Kc===!1&&(Kc=!0,a.updateOffset(this),Kc=!1)}function o(a){return a instanceof n||null!=a&&null!=a._isAMomentObject}function p(a){return 0>a?Math.ceil(a):Math.floor(a)}function q(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=p(b)),c}function r(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&q(a[d])!==q(b[d]))&&g++;return g+f}function s(){}function t(a){return a?a.toLowerCase().replace("_","-"):a}function u(a){for(var b,c,d,e,f=0;f0;){if(d=v(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&r(e,c,!0)>=b-1)break;b--}f++}return null}function v(a){var b=null;if(!Lc[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=Ic._abbr,require("./locale/"+a),w(b)}catch(c){}return Lc[a]}function w(a,b){var c;return a&&(c="undefined"==typeof b?y(a):x(a,b),c&&(Ic=c)),Ic._abbr}function x(a,b){return null!==b?(b.abbr=a,Lc[a]=Lc[a]||new s,Lc[a].set(b),w(a),Lc[a]):(delete Lc[a],null)}function y(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return Ic;if(!c(a)){if(b=v(a))return b;a=[a]}return u(a)}function z(a,b){var c=a.toLowerCase();Mc[c]=Mc[c+"s"]=Mc[b]=a}function A(a){return"string"==typeof a?Mc[a]||Mc[a.toLowerCase()]:void 0}function B(a){var b,c,d={};for(c in a)f(a,c)&&(b=A(c),b&&(d[b]=a[c]));return d}function C(b,c){return function(d){return null!=d?(E(this,b,d),a.updateOffset(this,c),this):D(this,b)}}function D(a,b){return a._d["get"+(a._isUTC?"UTC":"")+b]()}function E(a,b,c){return a._d["set"+(a._isUTC?"UTC":"")+b](c)}function F(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else if(a=A(a),"function"==typeof this[a])return this[a](b);return this}function G(a,b,c){var d=""+Math.abs(a),e=b-d.length,f=a>=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}function H(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(Qc[a]=e),b&&(Qc[b[0]]=function(){return G(e.apply(this,arguments),b[1],b[2])}),c&&(Qc[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function I(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function J(a){var b,c,d=a.match(Nc);for(b=0,c=d.length;c>b;b++)Qc[d[b]]?d[b]=Qc[d[b]]:d[b]=I(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function K(a,b){return a.isValid()?(b=L(b,a.localeData()),Pc[b]=Pc[b]||J(b),Pc[b](a)):a.localeData().invalidDate()}function L(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Oc.lastIndex=0;d>=0&&Oc.test(a);)a=a.replace(Oc,c),Oc.lastIndex=0,d-=1;return a}function M(a){return"function"==typeof a&&"[object Function]"===Object.prototype.toString.call(a)}function N(a,b,c){dd[a]=M(b)?b:function(a){return a&&c?c:b}}function O(a,b){return f(dd,a)?dd[a](b._strict,b._locale):new RegExp(P(a))}function P(a){return a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Q(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),"number"==typeof b&&(d=function(a,c){c[b]=q(a)}),c=0;cd;d++){if(e=h([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function X(a,b){var c;return"string"==typeof b&&(b=a.localeData().monthsParse(b),"number"!=typeof b)?a:(c=Math.min(a.date(),T(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a)}function Y(b){return null!=b?(X(this,b),a.updateOffset(this,!0),this):D(this,"Month")}function Z(){return T(this.year(),this.month())}function $(a){var b,c=a._a;return c&&-2===j(a).overflow&&(b=c[gd]<0||c[gd]>11?gd:c[hd]<1||c[hd]>T(c[fd],c[gd])?hd:c[id]<0||c[id]>24||24===c[id]&&(0!==c[jd]||0!==c[kd]||0!==c[ld])?id:c[jd]<0||c[jd]>59?jd:c[kd]<0||c[kd]>59?kd:c[ld]<0||c[ld]>999?ld:-1,j(a)._overflowDayOfYear&&(fd>b||b>hd)&&(b=hd),j(a).overflow=b),a}function _(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function aa(a,b){var c=!0;return g(function(){return c&&(_(a+"\n"+(new Error).stack),c=!1),b.apply(this,arguments)},b)}function ba(a,b){od[a]||(_(b),od[a]=!0)}function ca(a){var b,c,d=a._i,e=pd.exec(d);if(e){for(j(a).iso=!0,b=0,c=qd.length;c>b;b++)if(qd[b][1].exec(d)){a._f=qd[b][0];break}for(b=0,c=rd.length;c>b;b++)if(rd[b][1].exec(d)){a._f+=(e[6]||" ")+rd[b][0];break}d.match(ad)&&(a._f+="Z"),va(a)}else a._isValid=!1}function da(b){var c=sd.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(ca(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}function ea(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function fa(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function ga(a){return ha(a)?366:365}function ha(a){return a%4===0&&a%100!==0||a%400===0}function ia(){return ha(this.year())}function ja(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=Da(a).add(f,"d"),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function ka(a){return ja(a,this._week.dow,this._week.doy).week}function la(){return this._week.dow}function ma(){return this._week.doy}function na(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function oa(a){var b=ja(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function pa(a,b,c,d,e){var f,g=6+e-d,h=fa(a,0,1+g),i=h.getUTCDay();return e>i&&(i+=7),c=null!=c?1*c:e,f=1+g+7*(b-1)-i+c,{year:f>0?a:a-1,dayOfYear:f>0?f:ga(a-1)+f}}function qa(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function ra(a,b,c){return null!=a?a:null!=b?b:c}function sa(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function ta(a){var b,c,d,e,f=[];if(!a._d){for(d=sa(a),a._w&&null==a._a[hd]&&null==a._a[gd]&&ua(a),a._dayOfYear&&(e=ra(a._a[fd],d[fd]),a._dayOfYear>ga(e)&&(j(a)._overflowDayOfYear=!0),c=fa(e,0,a._dayOfYear),a._a[gd]=c.getUTCMonth(),a._a[hd]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[id]&&0===a._a[jd]&&0===a._a[kd]&&0===a._a[ld]&&(a._nextDay=!0,a._a[id]=0),a._d=(a._useUTC?fa:ea).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[id]=24)}}function ua(a){var b,c,d,e,f,g,h;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=ra(b.GG,a._a[fd],ja(Da(),1,4).year),d=ra(b.W,1),e=ra(b.E,1)):(f=a._locale._week.dow,g=a._locale._week.doy,c=ra(b.gg,a._a[fd],ja(Da(),f,g).year),d=ra(b.w,1),null!=b.d?(e=b.d,f>e&&++d):e=null!=b.e?b.e+f:f),h=pa(c,d,e,g,f),a._a[fd]=h.year,a._dayOfYear=h.dayOfYear}function va(b){if(b._f===a.ISO_8601)return void ca(b);b._a=[],j(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,k=0;for(e=L(b._f,b._locale).match(Nc)||[],c=0;c0&&j(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),k+=d.length),Qc[f]?(d?j(b).empty=!1:j(b).unusedTokens.push(f),S(f,d,b)):b._strict&&!d&&j(b).unusedTokens.push(f);j(b).charsLeftOver=i-k,h.length>0&&j(b).unusedInput.push(h),j(b).bigHour===!0&&b._a[id]<=12&&b._a[id]>0&&(j(b).bigHour=void 0),b._a[id]=wa(b._locale,b._a[id],b._meridiem),ta(b),$(b)}function wa(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function xa(a){var b,c,d,e,f;if(0===a._f.length)return j(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;ef)&&(d=f,c=b));g(a,c||b)}function ya(a){if(!a._d){var b=B(a._i);a._a=[b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],ta(a)}}function za(a){var b=new n($(Aa(a)));return b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b}function Aa(a){var b=a._i,e=a._f;return a._locale=a._locale||y(a._l),null===b||void 0===e&&""===b?l({nullInput:!0}):("string"==typeof b&&(a._i=b=a._locale.preparse(b)),o(b)?new n($(b)):(c(e)?xa(a):e?va(a):d(b)?a._d=b:Ba(a),a))}function Ba(b){var f=b._i;void 0===f?b._d=new Date:d(f)?b._d=new Date(+f):"string"==typeof f?da(b):c(f)?(b._a=e(f.slice(0),function(a){return parseInt(a,10)}),ta(b)):"object"==typeof f?ya(b):"number"==typeof f?b._d=new Date(f):a.createFromInputFallback(b)}function Ca(a,b,c,d,e){var f={};return"boolean"==typeof c&&(d=c,c=void 0),f._isAMomentObject=!0,f._useUTC=f._isUTC=e,f._l=c,f._i=a,f._f=b,f._strict=d,za(f)}function Da(a,b,c,d){return Ca(a,b,c,d,!1)}function Ea(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return Da();for(d=b[0],e=1;ea&&(a=-a,c="-"),c+G(~~(a/60),2)+b+G(~~a%60,2)})}function Ka(a){var b=(a||"").match(ad)||[],c=b[b.length-1]||[],d=(c+"").match(xd)||["-",0,0],e=+(60*d[1])+q(d[2]);return"+"===d[0]?e:-e}function La(b,c){var e,f;return c._isUTC?(e=c.clone(),f=(o(b)||d(b)?+b:+Da(b))-+e,e._d.setTime(+e._d+f),a.updateOffset(e,!1),e):Da(b).local()}function Ma(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Na(b,c){var d,e=this._offset||0;return null!=b?("string"==typeof b&&(b=Ka(b)),Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Ma(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?bb(this,Ya(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Ma(this)}function Oa(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Pa(a){return this.utcOffset(0,a)}function Qa(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Ma(this),"m")),this}function Ra(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ka(this._i)),this}function Sa(a){return a=a?Da(a).utcOffset():0,(this.utcOffset()-a)%60===0}function Ta(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ua(){if("undefined"!=typeof this._isDSTShifted)return this._isDSTShifted;var a={};if(m(a,this),a=Aa(a),a._a){var b=a._isUTC?h(a._a):Da(a._a);this._isDSTShifted=this.isValid()&&r(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Va(){return!this._isUTC}function Wa(){return this._isUTC}function Xa(){return this._isUTC&&0===this._offset}function Ya(a,b){var c,d,e,g=a,h=null;return Ia(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(g={},b?g[b]=a:g.milliseconds=a):(h=yd.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:q(h[hd])*c,h:q(h[id])*c,m:q(h[jd])*c,s:q(h[kd])*c,ms:q(h[ld])*c}):(h=zd.exec(a))?(c="-"===h[1]?-1:1,g={y:Za(h[2],c),M:Za(h[3],c),d:Za(h[4],c),h:Za(h[5],c),m:Za(h[6],c),s:Za(h[7],c),w:Za(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=_a(Da(g.from),Da(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new Ha(g),Ia(a)&&f(a,"_locale")&&(d._locale=a._locale),d}function Za(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function $a(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function _a(a,b){var c;return b=La(b,a),a.isBefore(b)?c=$a(a,b):(c=$a(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c}function ab(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(ba(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Ya(c,d),bb(this,e,a),this}}function bb(b,c,d,e){var f=c._milliseconds,g=c._days,h=c._months;e=null==e?!0:e,f&&b._d.setTime(+b._d+f*d),g&&E(b,"Date",D(b,"Date")+g*d),h&&X(b,D(b,"Month")+h*d),e&&a.updateOffset(b,g||h)}function cb(a,b){var c=a||Da(),d=La(c,this).startOf("day"),e=this.diff(d,"days",!0),f=-6>e?"sameElse":-1>e?"lastWeek":0>e?"lastDay":1>e?"sameDay":2>e?"nextDay":7>e?"nextWeek":"sameElse";return this.format(b&&b[f]||this.localeData().calendar(f,this,Da(c)))}function db(){return new n(this)}function eb(a,b){var c;return b=A("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=o(a)?a:Da(a),+this>+a):(c=o(a)?+a:+Da(a),c<+this.clone().startOf(b))}function fb(a,b){var c;return b=A("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=o(a)?a:Da(a),+a>+this):(c=o(a)?+a:+Da(a),+this.clone().endOf(b)b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)}function kb(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function lb(){var a=this.clone().utc();return 0b;b++)if(this._weekdaysParse[b]||(c=Da([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b}function Pb(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Kb(a,this.localeData()),this.add(a-b,"d")):b}function Qb(a){var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function Rb(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)}function Sb(a,b){H(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function Tb(a,b){return b._meridiemParse}function Ub(a){return"p"===(a+"").toLowerCase().charAt(0)}function Vb(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Wb(a,b){b[ld]=q(1e3*("0."+a))}function Xb(){return this._isUTC?"UTC":""}function Yb(){return this._isUTC?"Coordinated Universal Time":""}function Zb(a){return Da(1e3*a)}function $b(){return Da.apply(null,arguments).parseZone()}function _b(a,b,c){var d=this._calendar[a];return"function"==typeof d?d.call(b,c):d}function ac(a){var b=this._longDateFormat[a],c=this._longDateFormat[a.toUpperCase()];return b||!c?b:(this._longDateFormat[a]=c.replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a])}function bc(){return this._invalidDate}function cc(a){return this._ordinal.replace("%d",a)}function dc(a){return a}function ec(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)}function fc(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)}function gc(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function hc(a,b,c,d){var e=y(),f=h().set(d,b);return e[c](f,a)}function ic(a,b,c,d,e){if("number"==typeof a&&(b=a,a=void 0),a=a||"",null!=b)return hc(a,b,c,e);var f,g=[];for(f=0;d>f;f++)g[f]=hc(a,f,c,e);return g}function jc(a,b){return ic(a,b,"months",12,"month")}function kc(a,b){return ic(a,b,"monthsShort",12,"month")}function lc(a,b){return ic(a,b,"weekdays",7,"day")}function mc(a,b){return ic(a,b,"weekdaysShort",7,"day")}function nc(a,b){return ic(a,b,"weekdaysMin",7,"day")}function oc(){var a=this._data;return this._milliseconds=Wd(this._milliseconds),this._days=Wd(this._days),this._months=Wd(this._months),a.milliseconds=Wd(a.milliseconds),a.seconds=Wd(a.seconds),a.minutes=Wd(a.minutes),a.hours=Wd(a.hours),a.months=Wd(a.months),a.years=Wd(a.years),this}function pc(a,b,c,d){var e=Ya(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function qc(a,b){return pc(this,a,b,1)}function rc(a,b){return pc(this,a,b,-1)}function sc(a){return 0>a?Math.floor(a):Math.ceil(a)}function tc(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;return f>=0&&g>=0&&h>=0||0>=f&&0>=g&&0>=h||(f+=864e5*sc(vc(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=p(f/1e3),i.seconds=a%60,b=p(a/60),i.minutes=b%60,c=p(b/60),i.hours=c%24,g+=p(c/24),e=p(uc(g)),h+=e,g-=sc(vc(e)),d=p(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function uc(a){return 4800*a/146097}function vc(a){return 146097*a/4800}function wc(a){var b,c,d=this._milliseconds;if(a=A(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+uc(b),"month"===a?c:c/12;switch(b=this._days+Math.round(vc(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function xc(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*q(this._months/12)}function yc(a){return function(){return this.as(a)}}function zc(a){return a=A(a),this[a+"s"]()}function Ac(a){return function(){return this._data[a]}}function Bc(){return p(this.days()/7)}function Cc(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function Dc(a,b,c){var d=Ya(a).abs(),e=ke(d.as("s")),f=ke(d.as("m")),g=ke(d.as("h")),h=ke(d.as("d")),i=ke(d.as("M")),j=ke(d.as("y")),k=e0,k[4]=c,Cc.apply(null,k)}function Ec(a,b){return void 0===le[a]?!1:void 0===b?le[a]:(le[a]=b,!0)}function Fc(a){var b=this.localeData(),c=Dc(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function Gc(){var a,b,c,d=me(this._milliseconds)/1e3,e=me(this._days),f=me(this._months);a=p(d/60),b=p(a/60),d%=60,a%=60,c=p(f/12),f%=12;var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(0>m?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}var Hc,Ic,Jc=a.momentProperties=[],Kc=!1,Lc={},Mc={},Nc=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Oc=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Pc={},Qc={},Rc=/\d/,Sc=/\d\d/,Tc=/\d{3}/,Uc=/\d{4}/,Vc=/[+-]?\d{6}/,Wc=/\d\d?/,Xc=/\d{1,3}/,Yc=/\d{1,4}/,Zc=/[+-]?\d{1,6}/,$c=/\d+/,_c=/[+-]?\d+/,ad=/Z|[+-]\d\d:?\d\d/gi,bd=/[+-]?\d+(\.\d{1,3})?/,cd=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,dd={},ed={},fd=0,gd=1,hd=2,id=3,jd=4,kd=5,ld=6;H("M",["MM",2],"Mo",function(){return this.month()+1}),H("MMM",0,0,function(a){return this.localeData().monthsShort(this,a)}),H("MMMM",0,0,function(a){return this.localeData().months(this,a)}),z("month","M"),N("M",Wc),N("MM",Wc,Sc),N("MMM",cd),N("MMMM",cd),Q(["M","MM"],function(a,b){b[gd]=q(a)-1}),Q(["MMM","MMMM"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict);null!=e?b[gd]=e:j(c).invalidMonth=a});var md="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),nd="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),od={};a.suppressDeprecationWarnings=!1;var pd=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,qd=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],rd=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],sd=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=aa("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),H(0,["YY",2],0,function(){return this.year()%100}),H(0,["YYYY",4],0,"year"),H(0,["YYYYY",5],0,"year"),H(0,["YYYYYY",6,!0],0,"year"),z("year","y"),N("Y",_c),N("YY",Wc,Sc),N("YYYY",Yc,Uc),N("YYYYY",Zc,Vc),N("YYYYYY",Zc,Vc),Q(["YYYYY","YYYYYY"],fd),Q("YYYY",function(b,c){c[fd]=2===b.length?a.parseTwoDigitYear(b):q(b)}),Q("YY",function(b,c){c[fd]=a.parseTwoDigitYear(b)}),a.parseTwoDigitYear=function(a){return q(a)+(q(a)>68?1900:2e3)};var td=C("FullYear",!1);H("w",["ww",2],"wo","week"),H("W",["WW",2],"Wo","isoWeek"),z("week","w"),z("isoWeek","W"),N("w",Wc),N("ww",Wc,Sc),N("W",Wc),N("WW",Wc,Sc),R(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=q(a)});var ud={dow:0,doy:6};H("DDD",["DDDD",3],"DDDo","dayOfYear"),z("dayOfYear","DDD"),N("DDD",Xc),N("DDDD",Tc),Q(["DDD","DDDD"],function(a,b,c){c._dayOfYear=q(a)}),a.ISO_8601=function(){};var vd=aa("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var a=Da.apply(null,arguments);return this>a?this:a}),wd=aa("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var a=Da.apply(null,arguments);return a>this?this:a});Ja("Z",":"),Ja("ZZ",""),N("Z",ad),N("ZZ",ad),Q(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ka(a)});var xd=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var yd=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,zd=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;Ya.fn=Ha.prototype;var Ad=ab(1,"add"),Bd=ab(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var Cd=aa("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});H(0,["gg",2],0,function(){return this.weekYear()%100}),H(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Db("gggg","weekYear"),Db("ggggg","weekYear"),Db("GGGG","isoWeekYear"),Db("GGGGG","isoWeekYear"),z("weekYear","gg"),z("isoWeekYear","GG"),N("G",_c),N("g",_c),N("GG",Wc,Sc),N("gg",Wc,Sc),N("GGGG",Yc,Uc),N("gggg",Yc,Uc),N("GGGGG",Zc,Vc),N("ggggg",Zc,Vc),R(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=q(a)}),R(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),H("Q",0,0,"quarter"),z("quarter","Q"),N("Q",Rc),Q("Q",function(a,b){b[gd]=3*(q(a)-1)}),H("D",["DD",2],"Do","date"),z("date","D"),N("D",Wc),N("DD",Wc,Sc),N("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),Q(["D","DD"],hd),Q("Do",function(a,b){b[hd]=q(a.match(Wc)[0],10)});var Dd=C("Date",!0);H("d",0,"do","day"),H("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),H("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),H("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),H("e",0,0,"weekday"),H("E",0,0,"isoWeekday"),z("day","d"),z("weekday","e"),z("isoWeekday","E"),N("d",Wc),N("e",Wc),N("E",Wc),N("dd",cd),N("ddd",cd),N("dddd",cd),R(["dd","ddd","dddd"],function(a,b,c){var d=c._locale.weekdaysParse(a);null!=d?b.d=d:j(c).invalidWeekday=a}),R(["d","e","E"],function(a,b,c,d){b[d]=q(a)});var Ed="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Fd="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Gd="Su_Mo_Tu_We_Th_Fr_Sa".split("_");H("H",["HH",2],0,"hour"),H("h",["hh",2],0,function(){return this.hours()%12||12}),Sb("a",!0),Sb("A",!1),z("hour","h"),N("a",Tb),N("A",Tb),N("H",Wc),N("h",Wc),N("HH",Wc,Sc),N("hh",Wc,Sc),Q(["H","HH"],id),Q(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),Q(["h","hh"],function(a,b,c){b[id]=q(a),j(c).bigHour=!0});var Hd=/[ap]\.?m?\.?/i,Id=C("Hours",!0);H("m",["mm",2],0,"minute"),z("minute","m"),N("m",Wc),N("mm",Wc,Sc),Q(["m","mm"],jd);var Jd=C("Minutes",!1);H("s",["ss",2],0,"second"),z("second","s"),N("s",Wc),N("ss",Wc,Sc),Q(["s","ss"],kd);var Kd=C("Seconds",!1);H("S",0,0,function(){return~~(this.millisecond()/100)}),H(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),H(0,["SSS",3],0,"millisecond"),H(0,["SSSS",4],0,function(){return 10*this.millisecond()}),H(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),H(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),H(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),H(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),H(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),z("millisecond","ms"),N("S",Xc,Rc),N("SS",Xc,Sc),N("SSS",Xc,Tc);var Ld;for(Ld="SSSS";Ld.length<=9;Ld+="S")N(Ld,$c);for(Ld="S";Ld.length<=9;Ld+="S")Q(Ld,Wb);var Md=C("Milliseconds",!1);H("z",0,0,"zoneAbbr"),H("zz",0,0,"zoneName");var Nd=n.prototype;Nd.add=Ad,Nd.calendar=cb,Nd.clone=db,Nd.diff=ib,Nd.endOf=ub,Nd.format=mb,Nd.from=nb,Nd.fromNow=ob,Nd.to=pb,Nd.toNow=qb,Nd.get=F,Nd.invalidAt=Cb,Nd.isAfter=eb,Nd.isBefore=fb,Nd.isBetween=gb,Nd.isSame=hb,Nd.isValid=Ab,Nd.lang=Cd,Nd.locale=rb,Nd.localeData=sb,Nd.max=wd,Nd.min=vd,Nd.parsingFlags=Bb,Nd.set=F,Nd.startOf=tb,Nd.subtract=Bd,Nd.toArray=yb,Nd.toObject=zb,Nd.toDate=xb,Nd.toISOString=lb,Nd.toJSON=lb,Nd.toString=kb,Nd.unix=wb,Nd.valueOf=vb,Nd.year=td,Nd.isLeapYear=ia,Nd.weekYear=Fb,Nd.isoWeekYear=Gb,Nd.quarter=Nd.quarters=Jb,Nd.month=Y,Nd.daysInMonth=Z,Nd.week=Nd.weeks=na,Nd.isoWeek=Nd.isoWeeks=oa,Nd.weeksInYear=Ib,Nd.isoWeeksInYear=Hb,Nd.date=Dd,Nd.day=Nd.days=Pb,Nd.weekday=Qb,Nd.isoWeekday=Rb,Nd.dayOfYear=qa,Nd.hour=Nd.hours=Id,Nd.minute=Nd.minutes=Jd,Nd.second=Nd.seconds=Kd, + Nd.millisecond=Nd.milliseconds=Md,Nd.utcOffset=Na,Nd.utc=Pa,Nd.local=Qa,Nd.parseZone=Ra,Nd.hasAlignedHourOffset=Sa,Nd.isDST=Ta,Nd.isDSTShifted=Ua,Nd.isLocal=Va,Nd.isUtcOffset=Wa,Nd.isUtc=Xa,Nd.isUTC=Xa,Nd.zoneAbbr=Xb,Nd.zoneName=Yb,Nd.dates=aa("dates accessor is deprecated. Use date instead.",Dd),Nd.months=aa("months accessor is deprecated. Use month instead",Y),Nd.years=aa("years accessor is deprecated. Use year instead",td),Nd.zone=aa("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Oa);var Od=Nd,Pd={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Qd={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},Rd="Invalid date",Sd="%d",Td=/\d{1,2}/,Ud={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Vd=s.prototype;Vd._calendar=Pd,Vd.calendar=_b,Vd._longDateFormat=Qd,Vd.longDateFormat=ac,Vd._invalidDate=Rd,Vd.invalidDate=bc,Vd._ordinal=Sd,Vd.ordinal=cc,Vd._ordinalParse=Td,Vd.preparse=dc,Vd.postformat=dc,Vd._relativeTime=Ud,Vd.relativeTime=ec,Vd.pastFuture=fc,Vd.set=gc,Vd.months=U,Vd._months=md,Vd.monthsShort=V,Vd._monthsShort=nd,Vd.monthsParse=W,Vd.week=ka,Vd._week=ud,Vd.firstDayOfYear=ma,Vd.firstDayOfWeek=la,Vd.weekdays=Lb,Vd._weekdays=Ed,Vd.weekdaysMin=Nb,Vd._weekdaysMin=Gd,Vd.weekdaysShort=Mb,Vd._weekdaysShort=Fd,Vd.weekdaysParse=Ob,Vd.isPM=Ub,Vd._meridiemParse=Hd,Vd.meridiem=Vb,w("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===q(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=aa("moment.lang is deprecated. Use moment.locale instead.",w),a.langData=aa("moment.langData is deprecated. Use moment.localeData instead.",y);var Wd=Math.abs,Xd=yc("ms"),Yd=yc("s"),Zd=yc("m"),$d=yc("h"),_d=yc("d"),ae=yc("w"),be=yc("M"),ce=yc("y"),de=Ac("milliseconds"),ee=Ac("seconds"),fe=Ac("minutes"),ge=Ac("hours"),he=Ac("days"),ie=Ac("months"),je=Ac("years"),ke=Math.round,le={s:45,m:45,h:22,d:26,M:11},me=Math.abs,ne=Ha.prototype;ne.abs=oc,ne.add=qc,ne.subtract=rc,ne.as=wc,ne.asMilliseconds=Xd,ne.asSeconds=Yd,ne.asMinutes=Zd,ne.asHours=$d,ne.asDays=_d,ne.asWeeks=ae,ne.asMonths=be,ne.asYears=ce,ne.valueOf=xc,ne._bubble=tc,ne.get=zc,ne.milliseconds=de,ne.seconds=ee,ne.minutes=fe,ne.hours=ge,ne.days=he,ne.weeks=Bc,ne.months=ie,ne.years=je,ne.humanize=Fc,ne.toISOString=Gc,ne.toString=Gc,ne.toJSON=Gc,ne.locale=rb,ne.localeData=sb,ne.toIsoString=aa("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Gc),ne.lang=Cd,H("X",0,0,"unix"),H("x",0,0,"valueOf"),N("x",_c),N("X",bd),Q("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),Q("x",function(a,b,c){c._d=new Date(q(a))}),a.version="2.10.6",b(Da),a.fn=Od,a.min=Fa,a.max=Ga,a.utc=h,a.unix=Zb,a.months=jc,a.isDate=d,a.locale=w,a.invalid=l,a.duration=Ya,a.isMoment=o,a.weekdays=lc,a.parseZone=$b,a.localeData=y,a.isDuration=Ia,a.monthsShort=kc,a.weekdaysMin=nc,a.defineLocale=x,a.weekdaysShort=mc,a.normalizeUnits=A,a.relativeTimeThreshold=Ec;var oe=a;return oe}); /*! * jQuery cxSelect * @name jquery.cxselect.js @@ -27560,6 +27567,1974 @@ S2.define('jquery.select2',[ datepickerPlugin.call($('[data-provide="datepicker-inline"]')); }); +})); +/* ========================================================= + * bootstrap-datetimepicker.js + * ========================================================= + * Copyright 2012 Stefan Petre + * + * Improvements by Andrew Rowls + * Improvements by Sébastien Malot + * Improvements by Yun Lai + * Improvements by Kenneth Henderick + * Improvements by CuGBabyBeaR + * Improvements by Christian Vaas + * + * Project URL : http://www.malot.fr/bootstrap-datetimepicker + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================================================= */ + + +(function(factory){ + if (typeof define === 'function' && define.amd) + define(['jquery'], factory); + else if (typeof exports === 'object') + factory(require('jquery')); + else + factory(jQuery); + +}(function($, undefined){ + + // Add ECMA262-5 Array methods if not supported natively (IE8) + if (!('indexOf' in Array.prototype)) { + Array.prototype.indexOf = function (find, i) { + if (i === undefined) i = 0; + if (i < 0) i += this.length; + if (i < 0) i = 0; + for (var n = this.length; i < n; i++) { + if (i in this && this[i] === find) { + return i; + } + } + return -1; + } + } + + // Add timezone abbreviation support for ie6+, Chrome, Firefox + function timeZoneAbbreviation() { + var abbreviation, date, formattedStr, i, len, matchedStrings, ref, str; + date = (new Date()).toString(); + formattedStr = ((ref = date.split('(')[1]) != null ? ref.slice(0, -1) : 0) || date.split(' '); + if (formattedStr instanceof Array) { + matchedStrings = []; + for (var i = 0, len = formattedStr.length; i < len; i++) { + str = formattedStr[i]; + if ((abbreviation = (ref = str.match(/\b[A-Z]+\b/)) !== null) ? ref[0] : 0) { + matchedStrings.push(abbreviation); + } + } + formattedStr = matchedStrings.pop(); + } + return formattedStr; + } + + function UTCDate() { + return new Date(Date.UTC.apply(Date, arguments)); + } + + // Picker object + var Datetimepicker = function (element, options) { + var that = this; + + this.element = $(element); + + // add container for single page application + // when page switch the datetimepicker div will be removed also. + this.container = options.container || 'body'; + + this.language = options.language || this.element.data('date-language') || 'en'; + this.language = this.language in dates ? this.language : this.language.split('-')[0]; // fr-CA fallback to fr + this.language = this.language in dates ? this.language : 'en'; + this.isRTL = dates[this.language].rtl || false; + this.formatType = options.formatType || this.element.data('format-type') || 'standard'; + this.format = DPGlobal.parseFormat(options.format || this.element.data('date-format') || dates[this.language].format || DPGlobal.getDefaultFormat(this.formatType, 'input'), this.formatType); + this.isInline = false; + this.isVisible = false; + this.isInput = this.element.is('input'); + this.fontAwesome = options.fontAwesome || this.element.data('font-awesome') || false; + + this.bootcssVer = options.bootcssVer || (this.isInput ? (this.element.is('.form-control') ? 3 : 2) : ( this.bootcssVer = this.element.is('.input-group') ? 3 : 2 )); + + this.component = this.element.is('.date') ? ( this.bootcssVer === 3 ? this.element.find('.input-group-addon .glyphicon-th, .input-group-addon .glyphicon-time, .input-group-addon .glyphicon-remove, .input-group-addon .glyphicon-calendar, .input-group-addon .fa-calendar, .input-group-addon .fa-clock-o').parent() : this.element.find('.add-on .icon-th, .add-on .icon-time, .add-on .icon-calendar, .add-on .fa-calendar, .add-on .fa-clock-o').parent()) : false; + this.componentReset = this.element.is('.date') ? ( this.bootcssVer === 3 ? this.element.find('.input-group-addon .glyphicon-remove, .input-group-addon .fa-times').parent():this.element.find('.add-on .icon-remove, .add-on .fa-times').parent()) : false; + this.hasInput = this.component && this.element.find('input').length; + if (this.component && this.component.length === 0) { + this.component = false; + } + this.linkField = options.linkField || this.element.data('link-field') || false; + this.linkFormat = DPGlobal.parseFormat(options.linkFormat || this.element.data('link-format') || DPGlobal.getDefaultFormat(this.formatType, 'link'), this.formatType); + this.minuteStep = options.minuteStep || this.element.data('minute-step') || 5; + this.pickerPosition = options.pickerPosition || this.element.data('picker-position') || 'bottom-right'; + this.showMeridian = options.showMeridian || this.element.data('show-meridian') || false; + this.initialDate = options.initialDate || new Date(); + this.zIndex = options.zIndex || this.element.data('z-index') || undefined; + this.title = typeof options.title === 'undefined' ? false : options.title; + this.timezone = options.timezone || timeZoneAbbreviation(); + + this.icons = { + leftArrow: this.fontAwesome ? 'fa-arrow-left' : (this.bootcssVer === 3 ? 'glyphicon-arrow-left' : 'icon-arrow-left'), + rightArrow: this.fontAwesome ? 'fa-arrow-right' : (this.bootcssVer === 3 ? 'glyphicon-arrow-right' : 'icon-arrow-right') + } + this.icontype = this.fontAwesome ? 'fa' : 'glyphicon'; + + this._attachEvents(); + + this.clickedOutside = function (e) { + // Clicked outside the datetimepicker, hide it + if ($(e.target).closest('.datetimepicker').length === 0) { + that.hide(); + } + } + + this.formatViewType = 'datetime'; + if ('formatViewType' in options) { + this.formatViewType = options.formatViewType; + } else if ('formatViewType' in this.element.data()) { + this.formatViewType = this.element.data('formatViewType'); + } + + this.minView = 0; + if ('minView' in options) { + this.minView = options.minView; + } else if ('minView' in this.element.data()) { + this.minView = this.element.data('min-view'); + } + this.minView = DPGlobal.convertViewMode(this.minView); + + this.maxView = DPGlobal.modes.length - 1; + if ('maxView' in options) { + this.maxView = options.maxView; + } else if ('maxView' in this.element.data()) { + this.maxView = this.element.data('max-view'); + } + this.maxView = DPGlobal.convertViewMode(this.maxView); + + this.wheelViewModeNavigation = false; + if ('wheelViewModeNavigation' in options) { + this.wheelViewModeNavigation = options.wheelViewModeNavigation; + } else if ('wheelViewModeNavigation' in this.element.data()) { + this.wheelViewModeNavigation = this.element.data('view-mode-wheel-navigation'); + } + + this.wheelViewModeNavigationInverseDirection = false; + + if ('wheelViewModeNavigationInverseDirection' in options) { + this.wheelViewModeNavigationInverseDirection = options.wheelViewModeNavigationInverseDirection; + } else if ('wheelViewModeNavigationInverseDirection' in this.element.data()) { + this.wheelViewModeNavigationInverseDirection = this.element.data('view-mode-wheel-navigation-inverse-dir'); + } + + this.wheelViewModeNavigationDelay = 100; + if ('wheelViewModeNavigationDelay' in options) { + this.wheelViewModeNavigationDelay = options.wheelViewModeNavigationDelay; + } else if ('wheelViewModeNavigationDelay' in this.element.data()) { + this.wheelViewModeNavigationDelay = this.element.data('view-mode-wheel-navigation-delay'); + } + + this.startViewMode = 2; + if ('startView' in options) { + this.startViewMode = options.startView; + } else if ('startView' in this.element.data()) { + this.startViewMode = this.element.data('start-view'); + } + this.startViewMode = DPGlobal.convertViewMode(this.startViewMode); + this.viewMode = this.startViewMode; + + this.viewSelect = this.minView; + if ('viewSelect' in options) { + this.viewSelect = options.viewSelect; + } else if ('viewSelect' in this.element.data()) { + this.viewSelect = this.element.data('view-select'); + } + this.viewSelect = DPGlobal.convertViewMode(this.viewSelect); + + this.forceParse = true; + if ('forceParse' in options) { + this.forceParse = options.forceParse; + } else if ('dateForceParse' in this.element.data()) { + this.forceParse = this.element.data('date-force-parse'); + } + var template = this.bootcssVer === 3 ? DPGlobal.templateV3 : DPGlobal.template; + while (template.indexOf('{iconType}') !== -1) { + template = template.replace('{iconType}', this.icontype); + } + while (template.indexOf('{leftArrow}') !== -1) { + template = template.replace('{leftArrow}', this.icons.leftArrow); + } + while (template.indexOf('{rightArrow}') !== -1) { + template = template.replace('{rightArrow}', this.icons.rightArrow); + } + this.picker = $(template) + .appendTo(this.isInline ? this.element : this.container) // 'body') + .on({ + click: $.proxy(this.click, this), + mousedown: $.proxy(this.mousedown, this) + }); + + if (this.wheelViewModeNavigation) { + if ($.fn.mousewheel) { + this.picker.on({mousewheel: $.proxy(this.mousewheel, this)}); + } else { + console.log('Mouse Wheel event is not supported. Please include the jQuery Mouse Wheel plugin before enabling this option'); + } + } + + if (this.isInline) { + this.picker.addClass('datetimepicker-inline'); + } else { + this.picker.addClass('datetimepicker-dropdown-' + this.pickerPosition + ' dropdown-menu'); + } + if (this.isRTL) { + this.picker.addClass('datetimepicker-rtl'); + var selector = this.bootcssVer === 3 ? '.prev span, .next span' : '.prev i, .next i'; + this.picker.find(selector).toggleClass(this.icons.leftArrow + ' ' + this.icons.rightArrow); + } + + $(document).on('mousedown touchend', this.clickedOutside); + + this.autoclose = false; + if ('autoclose' in options) { + this.autoclose = options.autoclose; + } else if ('dateAutoclose' in this.element.data()) { + this.autoclose = this.element.data('date-autoclose'); + } + + this.keyboardNavigation = true; + if ('keyboardNavigation' in options) { + this.keyboardNavigation = options.keyboardNavigation; + } else if ('dateKeyboardNavigation' in this.element.data()) { + this.keyboardNavigation = this.element.data('date-keyboard-navigation'); + } + + this.todayBtn = (options.todayBtn || this.element.data('date-today-btn') || false); + this.clearBtn = (options.clearBtn || this.element.data('date-clear-btn') || false); + this.todayHighlight = (options.todayHighlight || this.element.data('date-today-highlight') || false); + + this.weekStart = 0; + if (typeof options.weekStart !== 'undefined') { + this.weekStart = options.weekStart; + } else if (typeof this.element.data('date-weekstart') !== 'undefined') { + this.weekStart = this.element.data('date-weekstart'); + } else if (typeof dates[this.language].weekStart !== 'undefined') { + this.weekStart = dates[this.language].weekStart; + } + this.weekStart = this.weekStart % 7; + this.weekEnd = ((this.weekStart + 6) % 7); + this.onRenderDay = function (date) { + var render = (options.onRenderDay || function () { return []; })(date); + if (typeof render === 'string') { + render = [render]; + } + var res = ['day']; + return res.concat((render ? render : [])); + }; + this.onRenderHour = function (date) { + var render = (options.onRenderHour || function () { return []; })(date); + var res = ['hour']; + if (typeof render === 'string') { + render = [render]; + } + return res.concat((render ? render : [])); + }; + this.onRenderMinute = function (date) { + var render = (options.onRenderMinute || function () { return []; })(date); + var res = ['minute']; + if (typeof render === 'string') { + render = [render]; + } + if (date < this.startDate || date > this.endDate) { + res.push('disabled'); + } else if (Math.floor(this.date.getUTCMinutes() / this.minuteStep) === Math.floor(date.getUTCMinutes() / this.minuteStep)) { + res.push('active'); + } + return res.concat((render ? render : [])); + }; + this.onRenderYear = function (date) { + var render = (options.onRenderYear || function () { return []; })(date); + var res = ['year']; + if (typeof render === 'string') { + render = [render]; + } + if (this.date.getUTCFullYear() === date.getUTCFullYear()) { + res.push('active'); + } + var currentYear = date.getUTCFullYear(); + var endYear = this.endDate.getUTCFullYear(); + if (date < this.startDate || currentYear > endYear) { + res.push('disabled'); + } + return res.concat((render ? render : [])); + } + this.onRenderMonth = function (date) { + var render = (options.onRenderMonth || function () { return []; })(date); + var res = ['month']; + if (typeof render === 'string') { + render = [render]; + } + return res.concat((render ? render : [])); + } + this.startDate = new Date(-8639968443048000); + this.endDate = new Date(8639968443048000); + this.datesDisabled = []; + this.daysOfWeekDisabled = []; + this.setStartDate(options.startDate || this.element.data('date-startdate')); + this.setEndDate(options.endDate || this.element.data('date-enddate')); + this.setDatesDisabled(options.datesDisabled || this.element.data('date-dates-disabled')); + this.setDaysOfWeekDisabled(options.daysOfWeekDisabled || this.element.data('date-days-of-week-disabled')); + this.setMinutesDisabled(options.minutesDisabled || this.element.data('date-minute-disabled')); + this.setHoursDisabled(options.hoursDisabled || this.element.data('date-hour-disabled')); + this.fillDow(); + this.fillMonths(); + this.update(); + this.showMode(); + + if (this.isInline) { + this.show(); + } + }; + + Datetimepicker.prototype = { + constructor: Datetimepicker, + + _events: [], + _attachEvents: function () { + this._detachEvents(); + if (this.isInput) { // single input + this._events = [ + [this.element, { + focus: $.proxy(this.show, this), + keyup: $.proxy(this.update, this), + keydown: $.proxy(this.keydown, this) + }] + ]; + } + else if (this.component && this.hasInput) { // component: input + button + this._events = [ + // For components that are not readonly, allow keyboard nav + [this.element.find('input'), { + focus: $.proxy(this.show, this), + keyup: $.proxy(this.update, this), + keydown: $.proxy(this.keydown, this) + }], + [this.component, { + click: $.proxy(this.show, this) + }] + ]; + if (this.componentReset) { + this._events.push([ + this.componentReset, + {click: $.proxy(this.reset, this)} + ]); + } + } + else if (this.element.is('div')) { // inline datetimepicker + this.isInline = true; + } + else { + this._events = [ + [this.element, { + click: $.proxy(this.show, this) + }] + ]; + } + for (var i = 0, el, ev; i < this._events.length; i++) { + el = this._events[i][0]; + ev = this._events[i][1]; + el.on(ev); + } + }, + + _detachEvents: function () { + for (var i = 0, el, ev; i < this._events.length; i++) { + el = this._events[i][0]; + ev = this._events[i][1]; + el.off(ev); + } + this._events = []; + }, + + show: function (e) { + this.picker.show(); + this.height = this.component ? this.component.outerHeight() : this.element.outerHeight(); + if (this.forceParse) { + this.update(); + } + this.place(); + $(window).on('resize', $.proxy(this.place, this)); + if (e) { + e.stopPropagation(); + e.preventDefault(); + } + this.isVisible = true; + this.element.trigger({ + type: 'show', + date: this.date + }); + }, + + hide: function () { + if (!this.isVisible) return; + if (this.isInline) return; + this.picker.hide(); + $(window).off('resize', this.place); + this.viewMode = this.startViewMode; + this.showMode(); + if (!this.isInput) { + $(document).off('mousedown', this.hide); + } + + if ( + this.forceParse && + ( + this.isInput && this.element.val() || + this.hasInput && this.element.find('input').val() + ) + ) + this.setValue(); + this.isVisible = false; + this.element.trigger({ + type: 'hide', + date: this.date + }); + }, + + remove: function () { + this._detachEvents(); + $(document).off('mousedown', this.clickedOutside); + this.picker.remove(); + delete this.picker; + delete this.element.data().datetimepicker; + }, + + getDate: function () { + var d = this.getUTCDate(); + if (d === null) { + return null; + } + return new Date(d.getTime() + (d.getTimezoneOffset() * 60000)); + }, + + getUTCDate: function () { + return this.date; + }, + + getInitialDate: function () { + return this.initialDate + }, + + setInitialDate: function (initialDate) { + this.initialDate = initialDate; + }, + + setDate: function (d) { + this.setUTCDate(new Date(d.getTime() - (d.getTimezoneOffset() * 60000))); + }, + + setUTCDate: function (d) { + if (d >= this.startDate && d <= this.endDate) { + this.date = d; + this.setValue(); + this.viewDate = this.date; + this.fill(); + } else { + this.element.trigger({ + type: 'outOfRange', + date: d, + startDate: this.startDate, + endDate: this.endDate + }); + } + }, + + setFormat: function (format) { + this.format = DPGlobal.parseFormat(format, this.formatType); + var element; + if (this.isInput) { + element = this.element; + } else if (this.component) { + element = this.element.find('input'); + } + if (element && element.val()) { + this.setValue(); + } + }, + + setValue: function () { + var formatted = this.getFormattedDate(); + if (!this.isInput) { + if (this.component) { + this.element.find('input').val(formatted); + } + this.element.data('date', formatted); + } else { + this.element.val(formatted); + } + if (this.linkField) { + $('#' + this.linkField).val(this.getFormattedDate(this.linkFormat)); + } + }, + + getFormattedDate: function (format) { + format = format || this.format; + return DPGlobal.formatDate(this.date, format, this.language, this.formatType, this.timezone); + }, + + setStartDate: function (startDate) { + this.startDate = startDate || this.startDate; + if (this.startDate.valueOf() !== 8639968443048000) { + this.startDate = DPGlobal.parseDate(this.startDate, this.format, this.language, this.formatType, this.timezone); + } + this.update(); + this.updateNavArrows(); + }, + + setEndDate: function (endDate) { + this.endDate = endDate || this.endDate; + if (this.endDate.valueOf() !== 8639968443048000) { + this.endDate = DPGlobal.parseDate(this.endDate, this.format, this.language, this.formatType, this.timezone); + } + this.update(); + this.updateNavArrows(); + }, + + setDatesDisabled: function (datesDisabled) { + this.datesDisabled = datesDisabled || []; + if (!$.isArray(this.datesDisabled)) { + this.datesDisabled = this.datesDisabled.split(/,\s*/); + } + var mThis = this; + this.datesDisabled = $.map(this.datesDisabled, function (d) { + return DPGlobal.parseDate(d, mThis.format, mThis.language, mThis.formatType, mThis.timezone).toDateString(); + }); + this.update(); + this.updateNavArrows(); + }, + + setTitle: function (selector, value) { + return this.picker.find(selector) + .find('th:eq(1)') + .text(this.title === false ? value : this.title); + }, + + setDaysOfWeekDisabled: function (daysOfWeekDisabled) { + this.daysOfWeekDisabled = daysOfWeekDisabled || []; + if (!$.isArray(this.daysOfWeekDisabled)) { + this.daysOfWeekDisabled = this.daysOfWeekDisabled.split(/,\s*/); + } + this.daysOfWeekDisabled = $.map(this.daysOfWeekDisabled, function (d) { + return parseInt(d, 10); + }); + this.update(); + this.updateNavArrows(); + }, + + setMinutesDisabled: function (minutesDisabled) { + this.minutesDisabled = minutesDisabled || []; + if (!$.isArray(this.minutesDisabled)) { + this.minutesDisabled = this.minutesDisabled.split(/,\s*/); + } + this.minutesDisabled = $.map(this.minutesDisabled, function (d) { + return parseInt(d, 10); + }); + this.update(); + this.updateNavArrows(); + }, + + setHoursDisabled: function (hoursDisabled) { + this.hoursDisabled = hoursDisabled || []; + if (!$.isArray(this.hoursDisabled)) { + this.hoursDisabled = this.hoursDisabled.split(/,\s*/); + } + this.hoursDisabled = $.map(this.hoursDisabled, function (d) { + return parseInt(d, 10); + }); + this.update(); + this.updateNavArrows(); + }, + + place: function () { + if (this.isInline) return; + + if (!this.zIndex) { + var index_highest = 0; + $('div').each(function () { + var index_current = parseInt($(this).css('zIndex'), 10); + if (index_current > index_highest) { + index_highest = index_current; + } + }); + this.zIndex = index_highest + 10; + } + + var offset, top, left, containerOffset; + if (this.container instanceof $) { + containerOffset = this.container.offset(); + } else { + containerOffset = $(this.container).offset(); + } + + if (this.component) { + offset = this.component.offset(); + left = offset.left; + if (this.pickerPosition === 'bottom-left' || this.pickerPosition === 'top-left') { + left += this.component.outerWidth() - this.picker.outerWidth(); + } + } else { + offset = this.element.offset(); + left = offset.left; + if (this.pickerPosition === 'bottom-left' || this.pickerPosition === 'top-left') { + left += this.element.outerWidth() - this.picker.outerWidth(); + } + } + + var bodyWidth = document.body.clientWidth || window.innerWidth; + if (left + 220 > bodyWidth) { + left = bodyWidth - 220; + } + + if (this.pickerPosition === 'top-left' || this.pickerPosition === 'top-right') { + top = offset.top - this.picker.outerHeight(); + } else { + top = offset.top + this.height; + } + + top = top - containerOffset.top; + left = left - containerOffset.left; + + this.picker.css({ + top: top, + left: left, + zIndex: this.zIndex + }); + }, + + hour_minute: "^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]", + + update: function () { + var date, fromArgs = false; + if (arguments && arguments.length && (typeof arguments[0] === 'string' || arguments[0] instanceof Date)) { + date = arguments[0]; + fromArgs = true; + } else { + date = (this.isInput ? this.element.val() : this.element.find('input').val()) || this.element.data('date') || this.initialDate; + if (typeof date === 'string') { + date = date.replace(/^\s+|\s+$/g,''); + } + } + + if (!date) { + date = new Date(); + fromArgs = false; + } + + if (typeof date === "string") { + if (new RegExp(this.hour_minute).test(date) || new RegExp(this.hour_minute + ":[0-5][0-9]").test(date)) { + date = this.getDate() + } + } + + this.date = DPGlobal.parseDate(date, this.format, this.language, this.formatType, this.timezone); + + if (fromArgs) this.setValue(); + + if (this.date < this.startDate) { + this.viewDate = new Date(this.startDate); + } else if (this.date > this.endDate) { + this.viewDate = new Date(this.endDate); + } else { + this.viewDate = new Date(this.date); + } + this.fill(); + }, + + fillDow: function () { + var dowCnt = this.weekStart, + html = '
' + dates[this.language].daysMin[(dowCnt++) % 7] + '
' + prevMonth.getUTCDate() + '
' + + DPGlobal.headTemplate + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplate + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplate + + '' + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplate + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplate + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + ''; + DPGlobal.templateV3 = '
' + + '
' + + '' + + DPGlobal.headTemplateV3 + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplateV3 + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplateV3 + + '' + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplateV3 + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplateV3 + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
'; + $.fn.datetimepicker.DPGlobal = DPGlobal; + + /* DATETIMEPICKER NO CONFLICT + * =================== */ + + $.fn.datetimepicker.noConflict = function () { + $.fn.datetimepicker = old; + return this; + }; + + /* DATETIMEPICKER DATA-API + * ================== */ + + $(document).on( + 'focus.datetimepicker.data-api click.datetimepicker.data-api', + '[data-provide="datetimepicker"]', + function (e) { + var $this = $(this); + if ($this.data('datetimepicker')) return; + e.preventDefault(); + // component click requires us to explicitly show it + $this.datetimepicker('show'); + } + ); + $(function () { + $('[data-provide="datetimepicker-inline"]').datetimepicker(); + }); + })); /* * Copyright 2018-2018 the original author or authors. @@ -133786,6 +135761,23 @@ module.exports = tick; //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJjbGFzc2VzLmpzIiwiZHJhZ3VsYS5qcyIsIm5vZGVfbW9kdWxlcy9hdG9hL2F0b2EuanMiLCJub2RlX21vZHVsZXMvY29udHJhL2RlYm91bmNlLmpzIiwibm9kZV9tb2R1bGVzL2NvbnRyYS9lbWl0dGVyLmpzIiwibm9kZV9tb2R1bGVzL2Nyb3NzdmVudC9zcmMvY3Jvc3N2ZW50LmpzIiwibm9kZV9tb2R1bGVzL2Nyb3NzdmVudC9zcmMvZXZlbnRtYXAuanMiLCJub2RlX21vZHVsZXMvY3VzdG9tLWV2ZW50L2luZGV4LmpzIiwibm9kZV9tb2R1bGVzL3RpY2t5L3RpY2t5LWJyb3dzZXIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUNBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTt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haWwpO1xuICB9IGVsc2Uge1xuICAgIGUuaW5pdEN1c3RvbUV2ZW50KHR5cGUsIGZhbHNlLCBmYWxzZSwgdm9pZCAwKTtcbiAgfVxuICByZXR1cm4gZTtcbn0gOlxuXG4vLyBJRSA8PSA4XG5mdW5jdGlvbiBDdXN0b21FdmVudCAodHlwZSwgcGFyYW1zKSB7XG4gIHZhciBlID0gZG9jdW1lbnQuY3JlYXRlRXZlbnRPYmplY3QoKTtcbiAgZS50eXBlID0gdHlwZTtcbiAgaWYgKHBhcmFtcykge1xuICAgIGUuYnViYmxlcyA9IEJvb2xlYW4ocGFyYW1zLmJ1YmJsZXMpO1xuICAgIGUuY2FuY2VsYWJsZSA9IEJvb2xlYW4ocGFyYW1zLmNhbmNlbGFibGUpO1xuICAgIGUuZGV0YWlsID0gcGFyYW1zLmRldGFpbDtcbiAgfSBlbHNlIHtcbiAgICBlLmJ1YmJsZXMgPSBmYWxzZTtcbiAgICBlLmNhbmNlbGFibGUgPSBmYWxzZTtcbiAgICBlLmRldGFpbCA9IHZvaWQgMDtcbiAgfVxuICByZXR1cm4gZTtcbn1cbiIsInZhciBzaSA9IHR5cGVvZiBzZXRJbW1lZGlhdGUgPT09ICdmdW5jdGlvbicsIHRpY2s7XG5pZiAoc2kpIHtcbiAgdGljayA9IGZ1bmN0aW9uIChmbikgeyBzZXRJbW1lZGlhdGUoZm4pOyB9O1xufSBlbHNlIHtcbiAgdGljayA9IGZ1bmN0aW9uIChmbikgeyBzZXRUaW1lb3V0KGZuLCAwKTsgfTtcbn1cblxubW9kdWxlLmV4cG9ydHMgPSB0aWNrOyJdfQ== ; !function(a){a.fn.datepicker.dates["zh-CN"]={days:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],daysShort:["周日","周一","周二","周三","周四","周五","周六"],daysMin:["日","一","二","三","四","五","六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthsShort:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],today:"今天",monthsTitle:"选择月份",clear:"清除",format:"yyyy-mm-dd",titleFormat:"yyyy年mm月",weekStart:1}}(jQuery); +/** + * Simplified Chinese translation for bootstrap-datetimepicker + * Yuan Cheung + */ + +;(function($){ + $.fn.datetimepicker.dates['zh-CN'] = { + days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"], + daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"], + daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"], + months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], + monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], + today: "今天", + suffix: [], + meridiem: ["上午", "下午"] + }; +}(jQuery)); (function( factory ) { if ( typeof define === "function" && define.amd ) { define( ["jquery", "../jquery.validate"], factory ); @@ -134054,6 +136046,219 @@ $(document).on('turbolinks:load', function() { }); } }); +$(document).on('turbolinks:load', function(){ + if ($('body.admins-competition-settings-index-page').length > 0) { + + var dateOptions = { + autoclose: true, + language: 'zh-CN', + format: 'yyyy-mm-dd', + startDate: '2017-04-01' + }; + + var timeOptions = { + // autoclose: true, + language: 'zh-CN', + format: 'yyyy-mm-dd hh:ii:ss', + minuteStep: 30 + }; + + var defineDateRangeSelect = function (element) { + var options = $.extend({inputs: $(element).find('.start-date, .end-date')}, dateOptions); + $(element).datepicker(options); + + $(element).find('.start-date').datepicker().on('changeDate', function (e) { + $(element).find('.end-date').datepicker('setStartDate', e.date); + }); + }; + + var defineTimeRangeSelect = function (element) { + // var options = $.extend({inputs: $(element).find('.start-date, .end-date')}, timeOptions); + $(".start-date").datetimepicker(timeOptions); + + $(element).find('.start-date').datetimepicker().on('changeDate', function (e) { + $(element).find('.end-date').datetimepicker('setStartDate', e.date); + }); + }; + $(".competition-start-end-date .start-date").datetimepicker(); + + $(".competition-start-end-date .end-date").datetimepicker(); + + defineDateRangeSelect('.teaching-mode-date'); + // defineTimeRangeSelect('.competition-start-end-date'); + + var $basicForm = $('form.basic-setting-form'); + + $basicForm.validate({ + errorElement: 'span', + errorClass: 'danger text-danger', + rules: { + name: "required", + subTitle: "required", + startTime: "required", + endTime: "required", + mode: "required", + identifier: "required" + } + }); + + // 保存按钮 + $basicForm.on('click', ".submit-btn", function () { + $basicForm.find('.submit-btn').attr('disabled', 'disabled'); + $basicForm.find('.error').html(''); + var valid = $basicForm.valid(); + + if ($("input[name='mode']:checked").val() == 2) { + var $courseId = $("input[name='course_id'"); + if ($courseId.val() === undefined || $course_id.val().length === 0) { + $courseId.addClass('danger text-danger'); + valid = false; + } else { + $courseId.removeClass('danger text-danger'); + } + } else if ($("input[name='mode']:checked").val() == 4) { + var $techStartTime = $("input[name='teach_start_time'"); + var $techEndTime = $("input[name='teach_end_time'"); + if ($techStartTime.val() === undefined || $techStartTime.val().length === 0) { + $techStartTime.addClass('danger text-danger'); + valid = false; + } else { + $techStartTime.removeClass('danger text-danger'); + } + + if ($techEndTime.val() === undefined || $techEndTime.val().length === 0) { + $techEndTime.addClass('danger text-danger'); + valid = false; + } else { + $techEndTime.removeClass('danger text-danger'); + } + } + + if (!valid) return; + $.ajax({ + method: 'POST', + dataType: 'json', + url: $basicForm.attr('action'), + data: new FormData($basicForm[0]), + processData: false, + contentType: false, + success: function (data) { + $.notify({message: '保存成功'}); + // window.location.reload(); + }, + error: function (res) { + var data = res.responseJSON; + $basicForm.find('.error').html(data.message); + }, + complete: function () { + $basicForm.find('.submit-btn').attr('disabled', false); + } + }); + }); + } +}); + + +$(function () { + //MD编辑 + $("#MD_typeFrom").on("click",".add_MD_type",function () { + + var length=$(".MD_type").find(".add_MD_type").length + 1; + var html='
\n' + + '
\n' + + ' \n' + + '
\n' + + '
\n' + + '
\n' + + ' \n' + + ' \n' + + '
'; + $("#MD_typeFrom").append(html); + }) + $("#MD_typeFrom").on("click",".del_MD_type",function () { + $(this).parents(".MD_type").remove(); + }) + + + //链接 + $(".nav-setting-form").on("click",".add_linkBtn",function () { + var length=$(".nav-setting-form").find(".linkFormItem").length + 1; + var html='
\n' + + '
\n' + + ' \n' + + '
\n' + + '
\n' + + '
\n' + + '
\n' + + ' \n' + + ' \n' + + '
'; + $(this).parents(".lineFromItem").insertAfter(html); + }); + + $(".nav-setting-form").on("click",".del_linkBtn",function () { + $(this).parents(".lineFromItem").remove(); + }); + + //有关报名要求 + $("#addRequireBtn").on("click",function () { + var length=$("#requireForm").find(".requireForm_item").length + 1; + var html='
\n' + + '
  
\n' + + '
\n' + + ' \n' + + '
\n' + + ' ~\n' + + '
\n' + + ' \n' + + '
\n' + + ' \n' + + '
\n' + + ' \n' + + '
\n' + + '
\n' + + ' \n' + + '
\n' + + '
\n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + '
\n' + + '
'; + $("#requireForm").append(html); + }); + + $("#requireForm").on("click",".delRequrieBtn",function () { + $(this).parents(".requireForm_item").remove(); + }); + + $('.competition-staff-settings').on('click', '.mutiple-limited-radio', function(){ + var radio = $(this); + if (radio.is(':checked')) { + radio.parent().parent().siblings().find('.mutiple-limited-radio').attr('checked', false) + } else { + radio.parent().parent().siblings().find('.mutiple-limited-radio').attr('checked', true) + } + }) +}); $(document).on('turbolinks:load', function() { if ($('body.admins-competitions-index-page').length > 0) { $('.modal.admin-upload-file-modal').on('upload:success', function(e, data){ @@ -134551,7 +136756,7 @@ $(document).on('turbolinks:load', function() { let search_form = $(".search-form"); //导出 $(".competition-enroll-list-form").on("click","#enroll-lists-export",function () { - window.location.href = "/admins/competitions/"+$(this).attr("data-competition-id")+"/enroll_lists.xls?" + search_form.serialize(); + window.location.href = "/admins/competitions/"+$(this).attr("data-competition-id")+"/enroll_lists/export.xlsx?" + search_form.serialize(); }); } }); @@ -134848,7 +137053,7 @@ $(document).on('turbolinks:load', function() { }, templateResult: function (item) { if(!item.id || item.id === '') return item.text; - return item.real_name; + return $("" + item.real_name + " " + item.school_name + ' ' + item.hidden_phone + ""); }, templateSelection: function(item){ if (item.id) { @@ -135989,15 +138194,19 @@ $(document).on('turbolinks:load', function(){ var $unlockAction = $lockAction.siblings('.unlock-action'); var userId = $lockAction.data('id'); - - $.ajax({ - url: '/admins/users/' + userId + '/lock', - method: 'POST', - dataType: 'json', - success: function() { - showSuccessNotify(); - $lockAction.hide(); - $unlockAction.show(); + customConfirm({ + content: '确认加锁吗?', + ok: function(){ + $.ajax({ + url: '/admins/users/' + userId + '/lock', + method: 'POST', + dataType: 'json', + success: function() { + showSuccessNotify(); + $lockAction.hide(); + $unlockAction.show(); + } + }); } }); }); @@ -136008,17 +138217,21 @@ $(document).on('turbolinks:load', function(){ var $lockAction = $unlockAction.siblings('.lock-action'); var userId = $unlockAction.data('id'); - - $.ajax({ - url: '/admins/users/' + userId + '/unlock', - method: 'POST', - dataType: 'json', - success: function() { - showSuccessNotify(); - $lockAction.show(); - $unlockAction.hide(); + customConfirm({ + content: '确认解锁吗?', + ok: function () { + $.ajax({ + url: '/admins/users/' + userId + '/unlock', + method: 'POST', + dataType: 'json', + success: function() { + showSuccessNotify(); + $lockAction.show(); + $unlockAction.hide(); + } + }); } - }); + }) }); // active user @@ -136028,18 +138241,22 @@ $(document).on('turbolinks:load', function(){ var $lockAction = $activeAction.siblings('.lock-action'); var userId = $activeAction.data('id'); - - $.ajax({ - url: '/admins/users/' + userId + '/unlock', - method: 'POST', - dataType: 'json', - success: function() { - showSuccessNotify(); - $activeAction.hide(); - $lockAction.show(); - $unlockAction.hide(); + customConfirm({ + content: '确认激活吗?', + ok: function () { + $.ajax({ + url: '/admins/users/' + userId + '/unlock', + method: 'POST', + dataType: 'json', + success: function() { + showSuccessNotify(); + $activeAction.hide(); + $lockAction.show(); + $unlockAction.hide(); + } + }); } - }); + }) }); // ***************** reward grade modal ***************** @@ -136459,6 +138676,8 @@ $(document).on('turbolinks:load', function() { + + diff --git a/public/assets/admin-441d8f3722e5f73e5748aaeb6f517101474cb1eb48a99f119e561f08b9e9dc60.js.gz b/public/assets/admin-441d8f3722e5f73e5748aaeb6f517101474cb1eb48a99f119e561f08b9e9dc60.js.gz new file mode 100644 index 000000000..dc10ed9b6 Binary files /dev/null and b/public/assets/admin-441d8f3722e5f73e5748aaeb6f517101474cb1eb48a99f119e561f08b9e9dc60.js.gz differ diff --git a/public/assets/admin-60d200c1fcdf61a60537d29ccf4479c6b1e5e904208870a63b8ee677c96b347e.css.gz b/public/assets/admin-60d200c1fcdf61a60537d29ccf4479c6b1e5e904208870a63b8ee677c96b347e.css.gz deleted file mode 100644 index 44bb80d0d..000000000 Binary files a/public/assets/admin-60d200c1fcdf61a60537d29ccf4479c6b1e5e904208870a63b8ee677c96b347e.css.gz and /dev/null differ diff --git a/public/assets/admin-60d200c1fcdf61a60537d29ccf4479c6b1e5e904208870a63b8ee677c96b347e.css b/public/assets/admin-76c52986591f274f639ad48dfbb480a1aeeec7647b6fa28fa541e78a064b6316.css similarity index 98% rename from public/assets/admin-60d200c1fcdf61a60537d29ccf4479c6b1e5e904208870a63b8ee677c96b347e.css rename to public/assets/admin-76c52986591f274f639ad48dfbb480a1aeeec7647b6fa28fa541e78a064b6316.css index edf0f7f74..4c1872d1f 100644 --- a/public/assets/admin-60d200c1fcdf61a60537d29ccf4479c6b1e5e904208870a63b8ee677c96b347e.css +++ b/public/assets/admin-76c52986591f274f639ad48dfbb480a1aeeec7647b6fa28fa541e78a064b6316.css @@ -19161,6 +19161,362 @@ body[class*=jconfirm-no-scroll-] { transform: scale(1); } +/*! + * Datetimepicker for Bootstrap + * + * Copyright 2012 Stefan Petre + * Improvements by Andrew Rowls + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + */ +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker { + padding: 4px; + margin-top: 1px; + border-radius: 4px; + direction: ltr; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker-inline { + width: 220px; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker.datetimepicker-rtl { + direction: rtl; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker.datetimepicker-rtl table tr td span { + float: right; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker-dropdown, .datetimepicker-dropdown-left { + top: 0; + left: 0; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +[class*=" datetimepicker-dropdown"]:before { + content: ''; + display: inline-block; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-bottom: 7px solid #ccc; + border-bottom-color: rgba(0, 0, 0, 0.2); + position: absolute; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +[class*=" datetimepicker-dropdown"]:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #fff; + position: absolute; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +[class*=" datetimepicker-dropdown-top"]:before { + content: ''; + display: inline-block; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-top: 7px solid #ccc; + border-top-color: rgba(0, 0, 0, 0.2); + border-bottom: 0; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +[class*=" datetimepicker-dropdown-top"]:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-top: 6px solid #fff; + border-bottom: 0; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker-dropdown-bottom-left:before { + top: -7px; + right: 6px; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker-dropdown-bottom-left:after { + top: -6px; + right: 7px; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker-dropdown-bottom-right:before { + top: -7px; + left: 6px; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker-dropdown-bottom-right:after { + top: -6px; + left: 7px; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker-dropdown-top-left:before { + bottom: -7px; + right: 6px; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker-dropdown-top-left:after { + bottom: -6px; + right: 7px; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker-dropdown-top-right:before { + bottom: -7px; + left: 6px; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker-dropdown-top-right:after { + bottom: -6px; + left: 7px; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker > div { + display: none; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker.minutes div.datetimepicker-minutes { + display: block; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker.hours div.datetimepicker-hours { + display: block; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker.days div.datetimepicker-days { + display: block; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker.months div.datetimepicker-months { + display: block; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker.years div.datetimepicker-years { + display: block; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table { + margin: 0; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker td, .datetimepicker th { + text-align: center; + width: 20px; + height: 20px; + border-radius: 4px; + border: 0; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.table-striped .datetimepicker table tr td, .table-striped .datetimepicker table tr th { + background-color: transparent; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table tr td.minute:hover { + background: #eee; + cursor: pointer; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table tr td.hour:hover { + background: #eee; + cursor: pointer; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table tr td.day:hover { + background: #eee; + cursor: pointer; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table tr td.old, .datetimepicker table tr td.new { + color: #999; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table tr td.disabled, .datetimepicker table tr td.disabled:hover { + background: 0; + color: #999; + cursor: default; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table tr td.today, .datetimepicker table tr td.today:hover, .datetimepicker table tr td.today.disabled, .datetimepicker table tr td.today.disabled:hover { + background-color: #fde19a; + background-image: -webkit-gradient(linear, left top, left bottom, from(#fdd49a), to(#fdf59a)); + background-image: linear-gradient(to bottom, #fdd49a, #fdf59a); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a',endColorstr='#fdf59a',GradientType=0); + border-color: #fdf59a #fdf59a #fbed50; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table tr td.today:hover, .datetimepicker table tr td.today:hover:hover, .datetimepicker table tr td.today.disabled:hover, .datetimepicker table tr td.today.disabled:hover:hover, .datetimepicker table tr td.today:active, .datetimepicker table tr td.today:hover:active, .datetimepicker table tr td.today.disabled:active, .datetimepicker table tr td.today.disabled:hover:active, .datetimepicker table tr td.today.active, .datetimepicker table tr td.today:hover.active, .datetimepicker table tr td.today.disabled.active, .datetimepicker table tr td.today.disabled:hover.active, .datetimepicker table tr td.today.disabled, .datetimepicker table tr td.today:hover.disabled, .datetimepicker table tr td.today.disabled.disabled, .datetimepicker table tr td.today.disabled:hover.disabled, .datetimepicker table tr td.today[disabled], .datetimepicker table tr td.today:hover[disabled], .datetimepicker table tr td.today.disabled[disabled], .datetimepicker table tr td.today.disabled:hover[disabled] { + background-color: #fdf59a; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table tr td.today:active, .datetimepicker table tr td.today:hover:active, .datetimepicker table tr td.today.disabled:active, .datetimepicker table tr td.today.disabled:hover:active, .datetimepicker table tr td.today.active, .datetimepicker table tr td.today:hover.active, .datetimepicker table tr td.today.disabled.active, .datetimepicker table tr td.today.disabled:hover.active { + background-color: #fbf069; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table tr td.active, .datetimepicker table tr td.active:hover, .datetimepicker table tr td.active.disabled, .datetimepicker table tr td.active.disabled:hover { + background-color: #006dcc; + background-image: -webkit-gradient(linear, left top, left bottom, from(#08c), to(#04c)); + background-image: linear-gradient(to bottom, #08c, #04c); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc',endColorstr='#0044cc',GradientType=0); + border-color: #04c #04c #002a80; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); + color: #fff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table tr td.active:hover, .datetimepicker table tr td.active:hover:hover, .datetimepicker table tr td.active.disabled:hover, .datetimepicker table tr td.active.disabled:hover:hover, .datetimepicker table tr td.active:active, .datetimepicker table tr td.active:hover:active, .datetimepicker table tr td.active.disabled:active, .datetimepicker table tr td.active.disabled:hover:active, .datetimepicker table tr td.active.active, .datetimepicker table tr td.active:hover.active, .datetimepicker table tr td.active.disabled.active, .datetimepicker table tr td.active.disabled:hover.active, .datetimepicker table tr td.active.disabled, .datetimepicker table tr td.active:hover.disabled, .datetimepicker table tr td.active.disabled.disabled, .datetimepicker table tr td.active.disabled:hover.disabled, .datetimepicker table tr td.active[disabled], .datetimepicker table tr td.active:hover[disabled], .datetimepicker table tr td.active.disabled[disabled], .datetimepicker table tr td.active.disabled:hover[disabled] { + background-color: #04c; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table tr td.active:active, .datetimepicker table tr td.active:hover:active, .datetimepicker table tr td.active.disabled:active, .datetimepicker table tr td.active.disabled:hover:active, .datetimepicker table tr td.active.active, .datetimepicker table tr td.active:hover.active, .datetimepicker table tr td.active.disabled.active, .datetimepicker table tr td.active.disabled:hover.active { + background-color: #039; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table tr td span { + display: block; + width: 23%; + height: 54px; + line-height: 54px; + float: left; + margin: 1%; + cursor: pointer; + border-radius: 4px; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker .datetimepicker-hours span { + height: 26px; + line-height: 26px; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker .datetimepicker-hours table tr td span.hour_am, .datetimepicker .datetimepicker-hours table tr td span.hour_pm { + width: 14.6%; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker .datetimepicker-hours fieldset legend, .datetimepicker .datetimepicker-minutes fieldset legend { + margin-bottom: inherit; + line-height: 30px; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker .datetimepicker-minutes span { + height: 26px; + line-height: 26px; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table tr td span:hover { + background: #eee; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table tr td span.disabled, .datetimepicker table tr td span.disabled:hover { + background: 0; + color: #999; + cursor: default; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table tr td span.active, .datetimepicker table tr td span.active:hover, .datetimepicker table tr td span.active.disabled, .datetimepicker table tr td span.active.disabled:hover { + background-color: #006dcc; + background-image: -webkit-gradient(linear, left top, left bottom, from(#08c), to(#04c)); + background-image: linear-gradient(to bottom, #08c, #04c); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc',endColorstr='#0044cc',GradientType=0); + border-color: #04c #04c #002a80; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); + color: #fff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table tr td span.active:hover, .datetimepicker table tr td span.active:hover:hover, .datetimepicker table tr td span.active.disabled:hover, .datetimepicker table tr td span.active.disabled:hover:hover, .datetimepicker table tr td span.active:active, .datetimepicker table tr td span.active:hover:active, .datetimepicker table tr td span.active.disabled:active, .datetimepicker table tr td span.active.disabled:hover:active, .datetimepicker table tr td span.active.active, .datetimepicker table tr td span.active:hover.active, .datetimepicker table tr td span.active.disabled.active, .datetimepicker table tr td span.active.disabled:hover.active, .datetimepicker table tr td span.active.disabled, .datetimepicker table tr td span.active:hover.disabled, .datetimepicker table tr td span.active.disabled.disabled, .datetimepicker table tr td span.active.disabled:hover.disabled, .datetimepicker table tr td span.active[disabled], .datetimepicker table tr td span.active:hover[disabled], .datetimepicker table tr td span.active.disabled[disabled], .datetimepicker table tr td span.active.disabled:hover[disabled] { + background-color: #04c; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table tr td span.active:active, .datetimepicker table tr td span.active:hover:active, .datetimepicker table tr td span.active.disabled:active, .datetimepicker table tr td span.active.disabled:hover:active, .datetimepicker table tr td span.active.active, .datetimepicker table tr td span.active:hover.active, .datetimepicker table tr td span.active.disabled.active, .datetimepicker table tr td span.active.disabled:hover.active { + background-color: #039; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker table tr td span.old { + color: #999; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker th.switch { + width: 145px; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker th span.glyphicon { + pointer-events: none; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker thead tr:first-child th, .datetimepicker tfoot th { + cursor: pointer; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.datetimepicker thead tr:first-child th:hover, .datetimepicker tfoot th:hover { + background: #eee; +} + +/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */ +.input-append.date .add-on i, .input-prepend.date .add-on i, .input-group.date .input-group-addon span { + cursor: pointer; + width: 14px; + height: 14px; +} + /* BASICS */ /* line 3, vendor/assets/codemirror/lib/codemirror.css */ .CodeMirror { @@ -24796,68 +25152,93 @@ input.form-control { } /* line 37, app/assets/stylesheets/common.scss */ +.font-20 { + font-size: 20px !important; +} + +/* line 38, app/assets/stylesheets/common.scss */ +.font-24 { + font-size: 24px !important; +} + +/* line 39, app/assets/stylesheets/common.scss */ .padding10-5 { padding: 10px 5px; } -/* line 38, app/assets/stylesheets/common.scss */ +/* line 40, app/assets/stylesheets/common.scss */ .width100 { width: 100%; } -/* line 39, app/assets/stylesheets/common.scss */ +/* line 41, app/assets/stylesheets/common.scss */ .mb10 { margin-bottom: 10px; } -/* line 40, app/assets/stylesheets/common.scss */ +/* line 42, app/assets/stylesheets/common.scss */ .mt10 { margin-top: 10px; } -/* line 41, app/assets/stylesheets/common.scss */ +/* line 43, app/assets/stylesheets/common.scss */ .mr10 { margin-right: 10px; } -/* line 42, app/assets/stylesheets/common.scss */ +/* line 44, app/assets/stylesheets/common.scss */ +.ml10 { + margin-left: 10px; +} + +/* line 44, app/assets/stylesheets/common.scss */ +.ml20 { + margin-left: 20px; +} + +/* line 45, app/assets/stylesheets/common.scss */ .textarea-width-100 { width: 100%; resize: none; border: 1px solid #ccc; } -/* line 43, app/assets/stylesheets/common.scss */ +/* line 46, app/assets/stylesheets/common.scss */ .padding10 { padding: 10px; } -/* line 44, app/assets/stylesheets/common.scss */ +/* line 47, app/assets/stylesheets/common.scss */ .padding5-10 { padding: 5px 10px; } -/* line 45, app/assets/stylesheets/common.scss */ +/* line 48, app/assets/stylesheets/common.scss */ .position-r { position: relative; } -/* line 46, app/assets/stylesheets/common.scss */ +/* line 49, app/assets/stylesheets/common.scss */ .color-grey-c { color: #ccc; } -/* line 47, app/assets/stylesheets/common.scss */ +/* line 50, app/assets/stylesheets/common.scss */ +.color-blue { + color: #4CACFF; +} + +/* line 51, app/assets/stylesheets/common.scss */ .inline-block { display: inline-block; } -/* line 48, app/assets/stylesheets/common.scss */ +/* line 52, app/assets/stylesheets/common.scss */ .hide { display: none; } -/* line 49, app/assets/stylesheets/common.scss */ +/* line 53, app/assets/stylesheets/common.scss */ .show { display: block; } @@ -25171,6 +25552,47 @@ input.form-control { background: #fff; } +/* line 3, app/assets/stylesheets/admins/competition_settings.scss */ +.admins-competition-settings-index-page .competition-mode-container .row { + height: 35px; +} + +/* line 7, app/assets/stylesheets/admins/competition_settings.scss */ +.admins-competition-settings-index-page .competition-mode-container .des-row { + height: auto; +} + +/* line 11, app/assets/stylesheets/admins/competition_settings.scss */ +.admins-competition-settings-index-page .competition-mode-container .form-control { + font-size: 14px; +} + +/* line 22, app/assets/stylesheets/admins/competition_settings.scss */ +.admins-competition-settings-index-page .col-md-label { + -webkit-box-flex: 0; + flex: 0 0 10%; + max-width: 10%; + min-width: 30px; + padding-right: 15px; + padding-left: 15px; + position: relative; +} + +/* line 31, app/assets/stylesheets/admins/competition_settings.scss */ +.admins-competition-settings-index-page .col-md-label-s { + -webkit-box-flex: 0; + flex: 0 0 30px; + padding-right: 15px; + padding-left: 15px; + position: relative; +} + +/* line 38, app/assets/stylesheets/admins/competition_settings.scss */ +.admins-competition-settings-index-page .setBtn_s { + height: 35px; + line-height: 5px; +} + /* line 4, app/assets/stylesheets/admins/cooperatives.scss */ .admins-cooperatives-index-page .coo-img-card .coo-img-item > .drag { cursor: move; @@ -26059,7 +26481,7 @@ input.form-control { flex: 3; } -/* line 18, app/assets/stylesheets/admin.scss */ +/* line 19, app/assets/stylesheets/admin.scss */ body { width: 100vw; height: 100vh; @@ -26074,28 +26496,28 @@ body { overflow: hidden; } -/* line 32, app/assets/stylesheets/admin.scss */ +/* line 33, app/assets/stylesheets/admin.scss */ .simple_form .form-group .collection_radio_buttons { margin-bottom: 0px; } -/* line 36, app/assets/stylesheets/admin.scss */ +/* line 37, app/assets/stylesheets/admin.scss */ .simple_form .form-group .form-check-inline { height: calc(1.5em + 0.75rem + 2px); } -/* line 42, app/assets/stylesheets/admin.scss */ +/* line 43, app/assets/stylesheets/admin.scss */ input.form-control { font-size: 14px; } -/* line 46, app/assets/stylesheets/admin.scss */ +/* line 47, app/assets/stylesheets/admin.scss */ .btn-default { color: #666; background: #e1e1e1 !important; } -/* line 50, app/assets/stylesheets/admin.scss */ +/* line 51, app/assets/stylesheets/admin.scss */ .export-absolute { right: 20px; position: absolute; diff --git a/public/assets/admin-76c52986591f274f639ad48dfbb480a1aeeec7647b6fa28fa541e78a064b6316.css.gz b/public/assets/admin-76c52986591f274f639ad48dfbb480a1aeeec7647b6fa28fa541e78a064b6316.css.gz new file mode 100644 index 000000000..133f3c862 Binary files /dev/null and b/public/assets/admin-76c52986591f274f639ad48dfbb480a1aeeec7647b6fa28fa541e78a064b6316.css.gz differ diff --git a/public/assets/admin-c8c127fefa5eca98bca19832c246619318164e8f242635c07033e2423cc18a6f.js.gz b/public/assets/admin-c8c127fefa5eca98bca19832c246619318164e8f242635c07033e2423cc18a6f.js.gz deleted file mode 100644 index c89ad5256..000000000 Binary files a/public/assets/admin-c8c127fefa5eca98bca19832c246619318164e8f242635c07033e2423cc18a6f.js.gz and /dev/null differ diff --git a/public/assets/application-9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb.js.gz b/public/assets/application-9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb.js.gz index d95d2367e..f1ad01866 100644 Binary files a/public/assets/application-9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb.js.gz and b/public/assets/application-9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb.js.gz differ diff --git a/public/assets/college-18f5e8400331634e898a35acc2187815c096c25e0ab74aba341ae916166cd287.js.gz b/public/assets/college-18f5e8400331634e898a35acc2187815c096c25e0ab74aba341ae916166cd287.js.gz index 41e619b41..20b948a8a 100644 Binary files a/public/assets/college-18f5e8400331634e898a35acc2187815c096c25e0ab74aba341ae916166cd287.js.gz and b/public/assets/college-18f5e8400331634e898a35acc2187815c096c25e0ab74aba341ae916166cd287.js.gz differ diff --git a/public/assets/college-38f953d6ba5b85d3fab63cb3c2bbf0d057ccc6454d07cfaafac3b06da37b8437.css b/public/assets/college-93904c65d52c125aec0a463b9fd98bedda0018b78707f806be22685cca5d3747.css similarity index 99% rename from public/assets/college-38f953d6ba5b85d3fab63cb3c2bbf0d057ccc6454d07cfaafac3b06da37b8437.css rename to public/assets/college-93904c65d52c125aec0a463b9fd98bedda0018b78707f806be22685cca5d3747.css index 3f9b0c1bc..e87ddc78c 100644 --- a/public/assets/college-38f953d6ba5b85d3fab63cb3c2bbf0d057ccc6454d07cfaafac3b06da37b8437.css +++ b/public/assets/college-93904c65d52c125aec0a463b9fd98bedda0018b78707f806be22685cca5d3747.css @@ -15788,68 +15788,93 @@ input.form-control { } /* line 37, app/assets/stylesheets/common.scss */ +.font-20 { + font-size: 20px !important; +} + +/* line 38, app/assets/stylesheets/common.scss */ +.font-24 { + font-size: 24px !important; +} + +/* line 39, app/assets/stylesheets/common.scss */ .padding10-5 { padding: 10px 5px; } -/* line 38, app/assets/stylesheets/common.scss */ +/* line 40, app/assets/stylesheets/common.scss */ .width100 { width: 100%; } -/* line 39, app/assets/stylesheets/common.scss */ +/* line 41, app/assets/stylesheets/common.scss */ .mb10 { margin-bottom: 10px; } -/* line 40, app/assets/stylesheets/common.scss */ +/* line 42, app/assets/stylesheets/common.scss */ .mt10 { margin-top: 10px; } -/* line 41, app/assets/stylesheets/common.scss */ +/* line 43, app/assets/stylesheets/common.scss */ .mr10 { margin-right: 10px; } -/* line 42, app/assets/stylesheets/common.scss */ +/* line 44, app/assets/stylesheets/common.scss */ +.ml10 { + margin-left: 10px; +} + +/* line 44, app/assets/stylesheets/common.scss */ +.ml20 { + margin-left: 20px; +} + +/* line 45, app/assets/stylesheets/common.scss */ .textarea-width-100 { width: 100%; resize: none; border: 1px solid #ccc; } -/* line 43, app/assets/stylesheets/common.scss */ +/* line 46, app/assets/stylesheets/common.scss */ .padding10 { padding: 10px; } -/* line 44, app/assets/stylesheets/common.scss */ +/* line 47, app/assets/stylesheets/common.scss */ .padding5-10 { padding: 5px 10px; } -/* line 45, app/assets/stylesheets/common.scss */ +/* line 48, app/assets/stylesheets/common.scss */ .position-r { position: relative; } -/* line 46, app/assets/stylesheets/common.scss */ +/* line 49, app/assets/stylesheets/common.scss */ .color-grey-c { color: #ccc; } -/* line 47, app/assets/stylesheets/common.scss */ +/* line 50, app/assets/stylesheets/common.scss */ +.color-blue { + color: #4CACFF; +} + +/* line 51, app/assets/stylesheets/common.scss */ .inline-block { display: inline-block; } -/* line 48, app/assets/stylesheets/common.scss */ +/* line 52, app/assets/stylesheets/common.scss */ .hide { display: none; } -/* line 49, app/assets/stylesheets/common.scss */ +/* line 53, app/assets/stylesheets/common.scss */ .show { display: block; } diff --git a/public/assets/college-38f953d6ba5b85d3fab63cb3c2bbf0d057ccc6454d07cfaafac3b06da37b8437.css.gz b/public/assets/college-93904c65d52c125aec0a463b9fd98bedda0018b78707f806be22685cca5d3747.css.gz similarity index 68% rename from public/assets/college-38f953d6ba5b85d3fab63cb3c2bbf0d057ccc6454d07cfaafac3b06da37b8437.css.gz rename to public/assets/college-93904c65d52c125aec0a463b9fd98bedda0018b78707f806be22685cca5d3747.css.gz index 80e2b4cf9..fe381fdc5 100644 Binary files a/public/assets/college-38f953d6ba5b85d3fab63cb3c2bbf0d057ccc6454d07cfaafac3b06da37b8437.css.gz and b/public/assets/college-93904c65d52c125aec0a463b9fd98bedda0018b78707f806be22685cca5d3747.css.gz differ diff --git a/public/assets/cooperative-6273b766d6ef11dd56174d868bab55e7f17af17546c888d2ba0dd0a6bcda76c8.css b/public/assets/cooperative-10a9ee5177e196572573ccea460e133c748072e223fdb473d05ee72c991fbbe3.css similarity index 99% rename from public/assets/cooperative-6273b766d6ef11dd56174d868bab55e7f17af17546c888d2ba0dd0a6bcda76c8.css rename to public/assets/cooperative-10a9ee5177e196572573ccea460e133c748072e223fdb473d05ee72c991fbbe3.css index 27be937e1..ca4917edf 100644 --- a/public/assets/cooperative-6273b766d6ef11dd56174d868bab55e7f17af17546c888d2ba0dd0a6bcda76c8.css +++ b/public/assets/cooperative-10a9ee5177e196572573ccea460e133c748072e223fdb473d05ee72c991fbbe3.css @@ -24796,68 +24796,93 @@ input.form-control { } /* line 37, app/assets/stylesheets/common.scss */ +.font-20 { + font-size: 20px !important; +} + +/* line 38, app/assets/stylesheets/common.scss */ +.font-24 { + font-size: 24px !important; +} + +/* line 39, app/assets/stylesheets/common.scss */ .padding10-5 { padding: 10px 5px; } -/* line 38, app/assets/stylesheets/common.scss */ +/* line 40, app/assets/stylesheets/common.scss */ .width100 { width: 100%; } -/* line 39, app/assets/stylesheets/common.scss */ +/* line 41, app/assets/stylesheets/common.scss */ .mb10 { margin-bottom: 10px; } -/* line 40, app/assets/stylesheets/common.scss */ +/* line 42, app/assets/stylesheets/common.scss */ .mt10 { margin-top: 10px; } -/* line 41, app/assets/stylesheets/common.scss */ +/* line 43, app/assets/stylesheets/common.scss */ .mr10 { margin-right: 10px; } -/* line 42, app/assets/stylesheets/common.scss */ +/* line 44, app/assets/stylesheets/common.scss */ +.ml10 { + margin-left: 10px; +} + +/* line 44, app/assets/stylesheets/common.scss */ +.ml20 { + margin-left: 20px; +} + +/* line 45, app/assets/stylesheets/common.scss */ .textarea-width-100 { width: 100%; resize: none; border: 1px solid #ccc; } -/* line 43, app/assets/stylesheets/common.scss */ +/* line 46, app/assets/stylesheets/common.scss */ .padding10 { padding: 10px; } -/* line 44, app/assets/stylesheets/common.scss */ +/* line 47, app/assets/stylesheets/common.scss */ .padding5-10 { padding: 5px 10px; } -/* line 45, app/assets/stylesheets/common.scss */ +/* line 48, app/assets/stylesheets/common.scss */ .position-r { position: relative; } -/* line 46, app/assets/stylesheets/common.scss */ +/* line 49, app/assets/stylesheets/common.scss */ .color-grey-c { color: #ccc; } -/* line 47, app/assets/stylesheets/common.scss */ +/* line 50, app/assets/stylesheets/common.scss */ +.color-blue { + color: #4CACFF; +} + +/* line 51, app/assets/stylesheets/common.scss */ .inline-block { display: inline-block; } -/* line 48, app/assets/stylesheets/common.scss */ +/* line 52, app/assets/stylesheets/common.scss */ .hide { display: none; } -/* line 49, app/assets/stylesheets/common.scss */ +/* line 53, app/assets/stylesheets/common.scss */ .show { display: block; } diff --git a/public/assets/cooperative-6273b766d6ef11dd56174d868bab55e7f17af17546c888d2ba0dd0a6bcda76c8.css.gz b/public/assets/cooperative-10a9ee5177e196572573ccea460e133c748072e223fdb473d05ee72c991fbbe3.css.gz similarity index 79% rename from public/assets/cooperative-6273b766d6ef11dd56174d868bab55e7f17af17546c888d2ba0dd0a6bcda76c8.css.gz rename to public/assets/cooperative-10a9ee5177e196572573ccea460e133c748072e223fdb473d05ee72c991fbbe3.css.gz index 9cc72c166..b010ce3e7 100644 Binary files a/public/assets/cooperative-6273b766d6ef11dd56174d868bab55e7f17af17546c888d2ba0dd0a6bcda76c8.css.gz and b/public/assets/cooperative-10a9ee5177e196572573ccea460e133c748072e223fdb473d05ee72c991fbbe3.css.gz differ diff --git a/public/assets/cooperative-9fb7ac4ad44081fafd5ad2a3a1bfb7f4329ac96f28bc6446d1ff52b1e2e71286.js b/public/assets/cooperative-6c4c663b6b5071535bab2b76cc5e05ab5682665857763a76bf4f01afef51be5a.js similarity index 99% rename from public/assets/cooperative-9fb7ac4ad44081fafd5ad2a3a1bfb7f4329ac96f28bc6446d1ff52b1e2e71286.js rename to public/assets/cooperative-6c4c663b6b5071535bab2b76cc5e05ab5682665857763a76bf4f01afef51be5a.js index 5d30eb714..e32ee97ba 100644 --- a/public/assets/cooperative-9fb7ac4ad44081fafd5ad2a3a1bfb7f4329ac96f28bc6446d1ff52b1e2e71286.js +++ b/public/assets/cooperative-6c4c663b6b5071535bab2b76cc5e05ab5682665857763a76bf4f01afef51be5a.js @@ -133786,6 +133786,23 @@ module.exports = tick; //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJjbGFzc2VzLmpzIiwiZHJhZ3VsYS5qcyIsIm5vZGVfbW9kdWxlcy9hdG9hL2F0b2EuanMiLCJub2RlX21vZHVsZXMvY29udHJhL2RlYm91bmNlLmpzIiwibm9kZV9tb2R1bGVzL2NvbnRyYS9lbWl0dGVyLmpzIiwibm9kZV9tb2R1bGVzL2Nyb3NzdmVudC9zcmMvY3Jvc3N2ZW50LmpzIiwibm9kZV9tb2R1bGVzL2Nyb3NzdmVudC9zcmMvZXZlbnRtYXAuanMiLCJub2RlX21vZHVsZXMvY3VzdG9tLWV2ZW50L2luZGV4LmpzIiwibm9kZV9tb2R1bGVzL3RpY2t5L3RpY2t5LWJyb3dzZXIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUNBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FB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uaW5pdEN1c3RvbUV2ZW50KHR5cGUsIGZhbHNlLCBmYWxzZSwgdm9pZCAwKTtcbiAgfVxuICByZXR1cm4gZTtcbn0gOlxuXG4vLyBJRSA8PSA4XG5mdW5jdGlvbiBDdXN0b21FdmVudCAodHlwZSwgcGFyYW1zKSB7XG4gIHZhciBlID0gZG9jdW1lbnQuY3JlYXRlRXZlbnRPYmplY3QoKTtcbiAgZS50eXBlID0gdHlwZTtcbiAgaWYgKHBhcmFtcykge1xuICAgIGUuYnViYmxlcyA9IEJvb2xlYW4ocGFyYW1zLmJ1YmJsZXMpO1xuICAgIGUuY2FuY2VsYWJsZSA9IEJvb2xlYW4ocGFyYW1zLmNhbmNlbGFibGUpO1xuICAgIGUuZGV0YWlsID0gcGFyYW1zLmRldGFpbDtcbiAgfSBlbHNlIHtcbiAgICBlLmJ1YmJsZXMgPSBmYWxzZTtcbiAgICBlLmNhbmNlbGFibGUgPSBmYWxzZTtcbiAgICBlLmRldGFpbCA9IHZvaWQgMDtcbiAgfVxuICByZXR1cm4gZTtcbn1cbiIsInZhciBzaSA9IHR5cGVvZiBzZXRJbW1lZGlhdGUgPT09ICdmdW5jdGlvbicsIHRpY2s7XG5pZiAoc2kpIHtcbiAgdGljayA9IGZ1bmN0aW9uIChmbikgeyBzZXRJbW1lZGlhdGUoZm4pOyB9O1xufSBlbHNlIHtcbiAgdGljayA9IGZ1bmN0aW9uIChmbikgeyBzZXRUaW1lb3V0KGZuLCAwKTsgfTtcbn1cblxubW9kdWxlLmV4cG9ydHMgPSB0aWNrOyJdfQ== ; !function(a){a.fn.datepicker.dates["zh-CN"]={days:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],daysShort:["周日","周一","周二","周三","周四","周五","周六"],daysMin:["日","一","二","三","四","五","六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthsShort:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],today:"今天",monthsTitle:"选择月份",clear:"清除",format:"yyyy-mm-dd",titleFormat:"yyyy年mm月",weekStart:1}}(jQuery); +/** + * Simplified Chinese translation for bootstrap-datetimepicker + * Yuan Cheung + */ + +;(function($){ + $.fn.datetimepicker.dates['zh-CN'] = { + days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"], + daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"], + daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"], + months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], + monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], + today: "今天", + suffix: [], + meridiem: ["上午", "下午"] + }; +}(jQuery)); (function( factory ) { if ( typeof define === "function" && define.amd ) { define( ["jquery", "../jquery.validate"], factory ); @@ -134069,7 +134086,7 @@ $(document).on('turbolinks:load', function() { }, templateResult: function (item) { if(!item.id || item.id === '') return item.text; - return item.real_name + "--" + item.identity; + return $("" + item.real_name + " " + item.school_name + ' ' + item.hidden_phone + ""); }, templateSelection: function(item){ if (item.id) { diff --git a/public/assets/cooperative-9fb7ac4ad44081fafd5ad2a3a1bfb7f4329ac96f28bc6446d1ff52b1e2e71286.js.gz b/public/assets/cooperative-6c4c663b6b5071535bab2b76cc5e05ab5682665857763a76bf4f01afef51be5a.js.gz similarity index 96% rename from public/assets/cooperative-9fb7ac4ad44081fafd5ad2a3a1bfb7f4329ac96f28bc6446d1ff52b1e2e71286.js.gz rename to public/assets/cooperative-6c4c663b6b5071535bab2b76cc5e05ab5682665857763a76bf4f01afef51be5a.js.gz index 4fb78eb9a..e0fde103b 100644 Binary files a/public/assets/cooperative-9fb7ac4ad44081fafd5ad2a3a1bfb7f4329ac96f28bc6446d1ff52b1e2e71286.js.gz and b/public/assets/cooperative-6c4c663b6b5071535bab2b76cc5e05ab5682665857763a76bf4f01afef51be5a.js.gz differ diff --git a/public/react/src/modules/competition/Noentry.jpg b/public/images/educoder/competitions/Noentry.jpg similarity index 100% rename from public/react/src/modules/competition/Noentry.jpg rename to public/images/educoder/competitions/Noentry.jpg diff --git a/public/react/src/modules/competition/Rectanglex.png b/public/images/educoder/competitions/Rectanglex.png similarity index 100% rename from public/react/src/modules/competition/Rectanglex.png rename to public/images/educoder/competitions/Rectanglex.png diff --git a/public/react/src/modules/competitions/Competitimain/courses.jpg b/public/images/educoder/competitions/courses.jpg similarity index 100% rename from public/react/src/modules/competitions/Competitimain/courses.jpg rename to public/images/educoder/competitions/courses.jpg diff --git a/public/react/src/modules/competitions/Competitimain/groups1.png b/public/images/educoder/competitions/groups1.png similarity index 100% rename from public/react/src/modules/competitions/Competitimain/groups1.png rename to public/images/educoder/competitions/groups1.png diff --git a/public/react/src/modules/competitions/Competitimain/groups2.png b/public/images/educoder/competitions/groups2.png similarity index 100% rename from public/react/src/modules/competitions/Competitimain/groups2.png rename to public/images/educoder/competitions/groups2.png diff --git a/public/react/src/modules/competitions/Competitimain/groups3.png b/public/images/educoder/competitions/groups3.png similarity index 100% rename from public/react/src/modules/competitions/Competitimain/groups3.png rename to public/images/educoder/competitions/groups3.png diff --git a/public/images/educoder/competitions/pexjiazai.png b/public/images/educoder/competitions/pexjiazai.png new file mode 100644 index 000000000..78f56b82a Binary files /dev/null and b/public/images/educoder/competitions/pexjiazai.png differ diff --git a/public/images/educoder/competitions/tipregistit.jpg b/public/images/educoder/competitions/tipregistit.jpg new file mode 100644 index 000000000..8aae50232 Binary files /dev/null and b/public/images/educoder/competitions/tipregistit.jpg differ diff --git a/public/react/src/App.js b/public/react/src/App.js index 43dc585d4..5988d3532 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -285,16 +285,12 @@ const Ecs = Loadable({ loading: Loading, }) -//团队竞赛报名 -const Registration = Loadable({ - loader: () => import('./modules/competition/Registration'), - loading: Loading, -}); -//个人竞赛报名 -const PersonalCompetit = Loadable({ - loader: () => import('./modules/competition/personal/PersonalCompetit.js'), - loading: Loading, -}); + +// //个人竞赛报名 +// const PersonalCompetit = Loadable({ +// loader: () => import('./modules/competition/personal/PersonalCompetit.js'), +// loading: Loading, +// }); class App extends Component { constructor(props) { super(props) @@ -490,7 +486,14 @@ class App extends Component { {/*/!*众包创新*!/*/} {/**/} {/*竞赛*/} - + { + + return () + } + }> + {/*认证*/} @@ -541,12 +544,12 @@ class App extends Component { return () } }> - () - } - /> + {/* ()*/} + {/*}*/} + {/*/>*/} */} {/**/} {/**/} - () - } - /> + {/* ()*/} + {/*}*/} + {/*/>*/} { if (prevProps.GetenrollmentAPI != this.props.GetenrollmentAPI) { - // console.log("团队竞赛报名大图componentDidUpdate"); - // console.log(this.props); - // console.log(this.props.GetenrollmentAPI); + // ////console.log("团队竞赛报名大图componentDidUpdate"); + // ////console.log(this.props); + // ////console.log(this.props.GetenrollmentAPI); this.setState({ GetenrollmentAPI: this.props.GetenrollmentAPI, }) @@ -29,9 +29,18 @@ class CompetitionMaxImg extends React.Component { let {type, pint} = this.props; return (
+ { type === 1 || type === 2 ? -
+

Educoder竞赛平台

Educoder是一个面向计算机类的互联网IT教育和实战平台,

提供企业级工程实训,以实现工程化专业教学的自动化和智能化。

@@ -47,7 +56,8 @@ class CompetitionMaxImg extends React.Component {
: type === 3 ? -
+

Educoder竞赛平台

高校智能课堂与综合实训平台

@@ -62,7 +72,8 @@ class CompetitionMaxImg extends React.Component {
: type === 4 || type === 5 ? -
+

Educoder竞赛平台

高校智能课堂与综合实训平台

@@ -76,15 +87,16 @@ class CompetitionMaxImg extends React.Component {
: type === 6 ? -
+

Educoder竞赛平台

Educoder是一个面向计算机类的互联网IT教育和实战平台,

提供企业级工程实训,以实现工程化专业教学的自动化和智能化。

{ pint === 1 ? -
-

立即报名

+
this.props.Personalregistration()}> +

this.props.Personalregistration()}>立即报名

: pint === 2 ?
@@ -99,7 +111,9 @@ class CompetitionMaxImg extends React.Component {
: - "" +
+
} diff --git a/public/react/src/modules/competition/RegisListview.js b/public/react/src/modules/competition/RegisListview.js index c2d725661..a1c283220 100644 --- a/public/react/src/modules/competition/RegisListview.js +++ b/public/react/src/modules/competition/RegisListview.js @@ -8,8 +8,8 @@ import axios from 'axios'; import moment from 'moment'; import competition from './comcss/competition.css'; import {Checkbox, Table, Pagination, Menu, Icon} from "antd"; +import {getImageUrl} from 'educoder'; // 团队竞赛报名无报名子组件团队 在线竞赛 > 全国高校计算机大赛-项目挑战> -import Rectanglex from "../../modules/competition/Rectanglex.png"; class RegisListview extends React.Component { constructor(props) { super(props) @@ -25,20 +25,20 @@ class RegisListview extends React.Component { display: "flex", justifyContent: " space-around", alignItems: "center", - background: `url(${Rectanglex})`, + background: `url(${getImageUrl(`images/educoder/competitions/Rectanglex.png`)})`, height: "50px", backgroundPosition: "center", backgroundSize: "110% 100%", }}> -

创建者

-

战队名称

-

战队成员

-

学校

-

时间

diff --git a/public/react/src/modules/competition/RegisListviewdata.js b/public/react/src/modules/competition/RegisListviewdata.js index 8e381568e..44fde6a4b 100644 --- a/public/react/src/modules/competition/RegisListviewdata.js +++ b/public/react/src/modules/competition/RegisListviewdata.js @@ -6,7 +6,7 @@ import { } from 'react-router-dom'; import axios from 'axios'; import moment from 'moment'; -import {SnackbarHOC, WordsBtn} from 'educoder'; +import {SnackbarHOC, WordsBtn, getImageUrl} from 'educoder'; import {TPMIndexHOC} from '../tpm/TPMIndexHOC'; import competition from './comcss/competition.css'; import {Button} from 'antd'; @@ -15,86 +15,124 @@ import {Button} from 'antd'; class RegisListviewdata extends React.Component { constructor(props) { super(props) - + this.state = { + item: undefined + } } + componentDidMount() { + ////console.log("RegisListviewdata"); + ////console.log(this.props.item) + this.setState({ + item: this.props.item + }) + } render() { + const {item} = this.props; return ( -
-
-
- -
-

小猫头像

-
-
-

重庆邮电大学

-
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-

重庆邮电大学

-
-
-

2019-09-07 08:33

-
- - +
+ { + item !== undefined ? +
+
+ +
+ + + +

{item.creator.name}

+
+
+

{item.name}

+
+
+ + { + item && item.team_members.map((item, index) => { + return ( + + index === 0 ? + + + + : index === 1 ? + + + + : index === 2 ? + + + + : index === 3 ? + + + + : index === 4 ? + + + + : index === 5 ? +
+ + + + + +
+ : "" + + ) + }) + } +
+
+

{item.school_name}

+
+
+

{item.created_at}

+
+
+
+ : "" + }
diff --git a/public/react/src/modules/competition/RegisNodata.js b/public/react/src/modules/competition/RegisNodata.js index 3f8835634..a8441f420 100644 --- a/public/react/src/modules/competition/RegisNodata.js +++ b/public/react/src/modules/competition/RegisNodata.js @@ -1,6 +1,6 @@ import React, {Component} from 'react'; import competition from './comcss/competition.css'; -import Noentry from './Noentry.jpg'; +import {getImageUrl} from 'educoder'; // 团队竞赛报名无报名子组件 class RegisNodata extends React.Component { constructor(props) { @@ -17,7 +17,7 @@ class RegisNodata extends React.Component { height: "80px", width: "125px", marginTop: "107px", - background: `url(${Noentry})`, + background: `url(${getImageUrl(`images/educoder/competitions/Noentry.jpg`)})`, backgroundPosition: "center", backgroundSize: "110% 100%", }}> diff --git a/public/react/src/modules/competition/Registration.js b/public/react/src/modules/competition/Registration.js index 60512a893..9bffc492c 100644 --- a/public/react/src/modules/competition/Registration.js +++ b/public/react/src/modules/competition/Registration.js @@ -9,7 +9,7 @@ import moment from 'moment'; import {SnackbarHOC, WordsBtn} from 'educoder'; import {TPMIndexHOC} from '../tpm/TPMIndexHOC'; import competition from './comcss/competition.css'; -import {Button, Pagination, message} from 'antd'; +import {Button, Pagination, message, Spin, Breadcrumb} from 'antd'; import Registrationitem from './Registrationitem'; import RegisNodata from './RegisNodata'; import CompetitionMaxImg from './CompetitionMaxImg'; @@ -19,7 +19,8 @@ import RegisListviewdata from './RegisListviewdata'; import PersonModal from './competmodal/PersonModal'; import MessagePersonModal from './competmodal/MessagePersonModal'; import PersonalModalteam from './competmodal/PersonalModalteam'; -import PersonalCompetititem from './personal/PersonalCompetititem' +import PersonalCompetititem from './personal/PersonalCompetititem'; +import ExittheteamModel from './competmodal/ExittheteamModel'; // 团队竞赛报名无报名 class Registration extends React.Component { /*** @@ -28,15 +29,15 @@ class Registration extends React.Component { *"enrolled: false, // 是否已经报名 *"teacher_staff": { // 为空表示不支持老师报名 *"member_staff": { // 为空表示不支持学生报名 + * personal// 是否是个人赛 * **/ constructor(props) { super(props) this.state = { - test: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], loadingstate: false, pages: 1, limit: 20, - type: 1, + type: 7, tmodalsType: false, tmodalsTypes: false, Newtit: true, @@ -44,6 +45,7 @@ class Registration extends React.Component { page: 1, per_page: 20, data: [], + competition_teams: [], count: 0, GetenrollmentAPI: undefined, personal: false, @@ -53,29 +55,58 @@ class Registration extends React.Component { member_staff: null, messagePer: "提示", messagePerbool: false, - intpermessages: "确认" + intpermessages: "确认", + messageexit: "提示", + messageexitol: false, + exitintpermessages: "是否确认退出战队?", + itemid: undefined, + itemiddata: [], + pint: 0, + } } componentDidMount() { - //console.log("componentDidMount Registration"); - // ////console.log("调用子组件 "); - //console.log(this.props.isAdmin()); - // ////console.log(this.props.isAdmin()) - const {keyword, page, per_page} = this.state; - this.Getdata(keyword, page, per_page); - this.GetenrollmentAPI(); + console.log(this.props); + + // //////console.log("componentDidMount Registration"); + // //// //////console.log("调用子组件 "); + // //////console.log(this.props.isAdmin()); + // //// //////console.log(this.props.isAdmin()) + try { + const {keyword, page, per_page} = this.state; + this.Getdata(keyword, page, per_page, this.props.user.admin); + this.GetenrollmentAPI(); + } catch (e) { + // const {keyword, page, per_page} = this.state; + // this.Getdata(keyword, page, per_page, this.props.isAdmin()); + // this.GetenrollmentAPI(); + } + } + + componentDidUpdate = (prevProps) => { + if (prevProps.user != this.props.user) { + console.log("componentDidUpdate"); + console.log(this.props); + ////console.log("Registration"); + ////console.log("componentDidUpdate"); + ////console.log(this.props.user.admin); + const {keyword, page, per_page} = this.state; + this.Getdata(keyword, page, per_page, this.props.user.admin); + this.GetenrollmentAPI(); + } + } //获取报名配置API GetenrollmentAPI = () => { - const url = `/competitions/${"gcc-course-2019"}/competition_staff.json`; + const url = `/competitions/${this.props.match.params.identifier}/competition_staff.json`; axios.get((url)).then((result) => { if (result) { if (result.data) { - ////console.log("获取报名配置API"); - ////console.log(result); + //// //////console.log("获取报名配置API"); + //// //////console.log(result); this.setState({ GetenrollmentAPI: result.data, personal: result.data.personal, @@ -84,14 +115,27 @@ class Registration extends React.Component { teacher_staff: result.data.teacher_staff, member_staff: result.data.member_staff, }) + if (result.data.enroll_ended === true) { + this.setState({ + pint: 0 + }) + } else if (result.data.enrolled === true) { + this.setState({ + pint: 2 + }) + } else if (result.data.enrolled === false) { + this.setState({ + pint: 1 + }) + } } } }).catch((error) => { - ////console.log(error); + //// //////console.log(error); }) } - Getdata = (keyword, page, per_page) => { + Getdata = (keyword, page, per_page, admin) => { //搜索关键字 keyword //页数 page //分页 per_page @@ -100,66 +144,234 @@ class Registration extends React.Component { page: page, per_page: per_page, }; - let url = `/competitions/${"gcc-course-2019"}/competition_teams.json`; + let url = `/competitions/${this.props.match.params.identifier}/competition_teams.json`; axios.get((url), {params: datas}).then((result) => { if (result) { if (result.data) { - ////console.log(result); - if (result.data.count === 0) { - // 没有创建数据的 - if (this.props.isAdmin() === true) { - //管理员 - this.setState({ - type: 4, - count: result.data.count, - }) + //// //////console.log(result);\ + if (result.data.personal === false) { + //不是个人赛 + if (result.data.my_teams.length === 0) { + // 没有创建数据的 + if (admin === true) { + //管理员 + this.setState({ + type: 4, + count: result.data.count, + data: result.data.my_teams, + competition_teams: result.data.competition_teams, + personal: result.data.personal, + }) + } else { + //普通账号 + this.setState({ + type: 1, + count: result.data.count, + data: result.data.my_teams, + competition_teams: result.data.competition_teams, + personal: result.data.personal, + }) + } } else { - //普通人 - this.setState({ - type: 1, - count: result.data.count, - }) + //有数据的 + + if (admin === true) { + if (result.data.my_teams[0].manage_permission === true) { + this.setState({ + type: 5, + data: result.data.my_teams, + count: result.data.count, + competition_teams: result.data.competition_teams, + personal: result.data.personal, + + }) + } else { + this.setState({ + type: 4, + data: result.data.my_teams, + count: result.data.count, + competition_teams: result.data.competition_teams, + personal: result.data.personal, + + }) + } + } else { + if (result.data.my_teams[0].manage_permission === true) { + //普通账号true 为创建了竞赛 + this.setState({ + type: 2, + data: result.data.my_teams, + count: result.data.count, + personal: result.data.personal, + + }) + } else { + //普通账号true 加入了竞赛 + this.setState({ + type: 3, + data: result.data.my_teams, + count: result.data.count, + personal: result.data.personal, + + }) + } + } + } + } else { + this.setState({ + type: 6, + data: result.data.my_teams, + count: result.data.count, + competition_teams: result.data.competition_teams, + personal: result.data.personal, + + }) + + } + } + } + this.setState({ + loadingstate: false, + }) + }).catch((error) => { + if (admin === true) { + //管理员 + this.setState({ + type: 4, + count: 0, + competition_teams: [], + data: [], + loadingstate: false, + }) + } else { + //普通账号 + this.setState({ + type: 1, + count: 0, + competition_teams: [], + data: [], + loadingstate: false, + }) + } + }) + + } + + Getdatatype5 = (keyword, page, per_page, admin) => { + //搜索关键字 keyword + //页数 page + //分页 per_page + const datas = { + keyword: keyword, + page: page, + per_page: per_page, + }; + let url = `/competitions/${this.props.match.params.identifier}/competition_teams.json`; + axios.get((url), {params: datas}).then((result) => { + this.setState({ + loadingstate: false, + }) + if (result) { + if (result.data) { + //// //////console.log(result); + if (result.data.personal === false) { + //不是个人赛 + ////console.log("Getdatatype5"); + ////console.log(result.data.my_teams.length); + if (result.data.my_teams.length === 0) { + // 没有创建数据的 + //管理员 + ////console.log("a"); + ////console.log(this.state.competition_teams); + ////console.log(result.data.competition_teams); + this.setState({ + type: 4, + count: result.data.count, + competition_teams: result.data.competition_teams, + data: result.data.my_teams, + personal: result.data.personal, + + }) } else { //有数据的 - if (this.props.isAdmin() === true) { + ////console.log("b"); + + if (result.data.my_teams[0].manage_permission === true) { this.setState({ type: 5, - data: result.data.competition_teams, + data: result.data.my_teams, count: result.data.count, + competition_teams: result.data.competition_teams, + personal: result.data.personal, + + }) } else { - if (result.data.competition_teams[0].manage_permission === true) { - //学生true 为创建了竞赛 - this.setState({ - type: 2, - data: result.data.competition_teams, - count: result.data.count, - }) - } else { - //学生true 加入了竞赛 + ////console.log("c"); + this.setState({ - type: 3, - data: result.data.competition_teams, - count: result.data.count, - }) - } + type: 4, + data: result.data.my_teams, + count: result.data.count, + competition_teams: result.data.competition_teams, + personal: result.data.personal, + + }) } + } + } else { + //团队赛 + //////console.log("d"); + + this.setState({ + type: 6, + data: result.data.my_teams, + count: result.data.count, + competition_teams: result.data.competition_teams, + personal: result.data.personal, + }) } } - } + }).catch((error) => { + ////console.log("k"); + ////console.log(error); + ////console.log("报错了"); + if (admin === true) { + //管理员 + this.setState({ + count: 0, + competition_teams: [], + data: [], + loadingstate: false, + }) + } else { + //普通账号 + this.setState({ + count: 0, + competition_teams: [], + data: [], + loadingstate: false, + }) + } }) } + + + //团队竞赛翻页 paginationonChangestwo = (pageNumber) => { this.setState({ pages: pageNumber, loadingstate: true, }) + const {keyword, per_page} = this.state; + this.Getdatatype5(keyword, pageNumber, per_page, this.props.user.admin); + }; /** * 加入战队 @@ -181,7 +393,7 @@ class Registration extends React.Component { }) return } - if (this.props.isAdmin() === true) { + if (this.props.user.admin === true) { //老师 if (this.state.teacher_staff === null) { //禁止老师 @@ -235,7 +447,7 @@ class Registration extends React.Component { }) return } - if (this.props.isAdmin() === true) { + if (this.props.user.admin === true) { //老师 if (this.state.teacher_staff === null) { //禁止老师 @@ -246,7 +458,8 @@ class Registration extends React.Component { return; } this.setState({ - tmodalsType: true + tmodalsType: true, + Newtit: true, }) } else { //学生 @@ -259,16 +472,20 @@ class Registration extends React.Component { return; } this.setState({ - tmodalsType: true + tmodalsType: true, + Newtit: true, }) } - - // this.setState({ - // tmodalsType: true - // }) } - + //编辑战队 + Createateamedit = (data) => { + this.setState({ + tmodalsType: true, + Newtit: false, + itemiddata: data + }) + } Tmoconfirm = (bool) => { //boolfalse 取消 true 确认 this.setState({ @@ -285,7 +502,7 @@ class Registration extends React.Component { } } - + //创建战队确认 Tmoconfirm1 = (bool) => { //boolfalse 取消 true 确认 this.setState({ @@ -293,8 +510,7 @@ class Registration extends React.Component { }) if (bool) { //确认 - - + this.Refreshteam(); } else { //取消 @@ -308,12 +524,101 @@ class Registration extends React.Component { messagePerbool: false }) } + //显示退出战队弹框 + Exittheteamshow = (itemid, bool) => { + if (bool === true) { + this.setState({ + messageexitol: true, + itemid: itemid, + exitintpermessages: "是否确认删除战队", + }) + } else { + this.setState({ + messageexitol: true, + itemid: itemid, + exitintpermessages: "是否确认退出战队", + }) + } + + + }; + //刷新战队 + Refreshteam = () => { + const {keyword, page, per_page} = this.state; + this.Getdata(keyword, page, per_page, this.props.user.admin); + this.GetenrollmentAPI(); + } + //退出战队 + Exittheteam = (bool) => { + // //////console.log(this.state.itemid); + if (bool) { + this.setState({ + messageexitol: true + }) + + let url = `/competitions/${"gcc-task-2020"}/competition_teams/${this.state.itemid}/leave.json`; + axios.post(url).then((response) => { + if (response) { + if (response.data) { + //////console.log("退出战队"); + //////console.log(response); + this.Refreshteam(); + this.setState({ + messageexitol: false + }) + + } + } + }).catch((error) => { + //////console.log(error) + }); + + } else { + this.setState({ + messageexitol: false + }) + } + } + //搜索战队 + RegistrationSearchvalue = (value) => { + ////console.log("RegistrationSearchvalue"); + ////console.log(this.props.user.admin); + this.setState({ + pages: 1, + limit: 20, + }) + this.Getdatatype5(value, 1, 20, this.props.user.admin); + } + + //个人竞赛 +// /competitions/:identifier/competition_teams.json + Personalregistration = () => { + let {teacher_staff, member_staff, data, enroll_ended, enrolled} = this.state; + if (enroll_ended === true) { + //已截止 + this.props.showNotification(`报名已截止`); + return; + } + if (enrolled === true) { + this.props.showNotification(`你已经报名,不能重复报名!`); + return; + } + const url = `/competitions/${this.props.match.params.identifier}/competition_teams.json`; + axios.post(url).then((response) => { + if (response) { + if (response.data) { + this.props.showNotification(`报名成功,预祝您夺得桂冠!`); + this.Refreshteam(); + } + } + }).catch((error) => { + + }); + } + render() { - const {test, page, pages, limit, type, tmodalsType, tmodalsTypes, data} = this.state; - const listItems = test.map((item, index) => - - ); + const {page, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams, Newtit, itemiddata, messagePerbool, messageexitol, GetenrollmentAPI, loadingstate, pint} = this.state; return (
@@ -329,43 +634,112 @@ class Registration extends React.Component { ` } - this.messagePerboolbuton()}> - this.Tmoconfirm1(bool)}> - this.Tmoconfirm(bool)}> -
-

- 在线竞赛 - > - 全国高校计算机大赛-项目挑战 - > - 报名 -

+ { + messagePerbool === true ? + this.messagePerboolbuton()} + GetenrollmentAPI={GetenrollmentAPI}> + : "" + } + {/*编辑创建战队*/} + { + tmodalsType === true ? + this.Tmoconfirm1(bool)}> + : + "" + } + { + tmodalsTypes === true ? + this.Tmoconfirm(bool)}> + : "" + } + { + messageexitol === true ? + this.Exittheteam(bool)}> + : "" + } + + {/*
*/} + {/*

*/} + {/* 在线竞赛*/} + {/* >*/} + {/* 全国高校计算机大赛-项目挑战*/} + {/* >*/} + {/* 报名*/} + {/*

*/} + {/*
*/} +
+ + 在线竞赛 + 全国高校计算机大赛 + 报名 +
{/*大图*/} this.Jointheteam()} + pint={pint} {...this.props} {...this.state} - Createateam={() => this.Createateam()}> + Createateam={() => this.Createateam()} + Personalregistration={() => this.Personalregistration()} + > {/*大图结尾*/} {/*没数据*/} + { + pint === 1 || pint === 3 ? +
+

参赛总人数:{data === null || data === undefined ? 0 : data.length} +

+
+ : ""} + {/*列表*/} + { + type === 6 ? +
+ + { + data && data.map((item, index) => { + return ( + + ) + }) + } + + + +
+ : ""} { type === 1 ? : "" } + {/*普通账号出现单人 战队弹框*/} { type === 2 || type === 3 || type === 5 ? - + this.Exittheteamshow(itemid)} + Createateamedit={(itemid) => this.Createateamedit(itemid)}> : "" } { type === 4 || type === 5 ? - + this.RegistrationSearchvalue(value)}> : "" } {/**/} @@ -378,19 +752,38 @@ class Registration extends React.Component { {type === 4 || type === 5 ? - listItems + + { + competition_teams && competition_teams.map((item, index) => { + return ( + + ) + }) + } + + : "" } { type === 4 || type === 5 ? -
- -
- : "" + ( + count < 20 ?
: +
+ +
+ ) + + :
}
@@ -401,4 +794,4 @@ class Registration extends React.Component { } -export default SnackbarHOC()(TPMIndexHOC(Registration)); +export default Registration; diff --git a/public/react/src/modules/competition/RegistrationSearch.js b/public/react/src/modules/competition/RegistrationSearch.js index ed7e326ba..122366e0d 100644 --- a/public/react/src/modules/competition/RegistrationSearch.js +++ b/public/react/src/modules/competition/RegistrationSearch.js @@ -24,15 +24,22 @@ class RegistrationSearch extends React.Component { this.setState({ keywords: e.target.value }) + }; setdatafuns = (value) => { - console.log("点击了搜索"); + //console.log("setdatafuns点击了搜索"); + //console.log(value); this.setState({ keywords: value }) - + this.props.RegistrationSearchvalue(value); }; + myonPressEnter = (e) => { + //console.log("点击了回车setdatafunsval点击了搜索"); + //console.log(e.target.value); + this.props.RegistrationSearchvalue(e.target.value); + } render() { return (
@@ -42,10 +49,21 @@ class RegistrationSearch extends React.Component { value={this.state.keywords} enterButton={搜索} onInput={(e) => this.setdatafunsval(e)} - onSearch={(value) => this.setdatafuns(value)}/> + onSearch={(value) => this.setdatafuns(value)} + onPressEnter={(e) => this.myonPressEnter(e)} + /> -

战队总数:271

+

战队总数:{this.props.count}

) } diff --git a/public/react/src/modules/competition/Registrationitem.js b/public/react/src/modules/competition/Registrationitem.js index 6bcd18534..d252dc30d 100644 --- a/public/react/src/modules/competition/Registrationitem.js +++ b/public/react/src/modules/competition/Registrationitem.js @@ -6,7 +6,7 @@ import { } from 'react-router-dom'; import axios from 'axios'; import moment from 'moment'; -import {SnackbarHOC, WordsBtn} from 'educoder'; +import {SnackbarHOC, WordsBtn, getImageUrl} from 'educoder'; import {TPMIndexHOC} from '../tpm/TPMIndexHOC'; import competition from './comcss/competition.css'; import {Button} from 'antd'; @@ -22,14 +22,16 @@ class Registrationitem extends React.Component { render() { - + let {item} = this.props; return ( - +
+ { + item !== undefined ?
-
+ -
+
小猫头像

+ }}>{item.creator.name}

+ { + item.manage_permission === true ? +

已报名

+ : + "" + } -

已报名

2019-09-07 08:33

+ }}>{item.created_at}

- - + : "" + } +
) } diff --git a/public/react/src/modules/competition/comcss/competition.css b/public/react/src/modules/competition/comcss/competition.css index 40e732139..2f7ec665d 100644 --- a/public/react/src/modules/competition/comcss/competition.css +++ b/public/react/src/modules/competition/comcss/competition.css @@ -8,16 +8,17 @@ } /*All*/ /*Registration.js*/ -.registrationback { - height: 368px; - width: 1200px; - border: 0.5px solid; - display: flex; - display: -webkit-flex; - flex-direction: column; - align-items: center; - background: #0dcecb; -} +/*.registrationback {*/ +/* height: 368px;*/ +/* width: 1200px;*/ +/* border: 0.5px solid;*/ +/* display: flex;*/ +/* display: -webkit-flex;*/ +/* flex-direction: column;*/ +/* align-items: center;*/ +/* background:url(../../../../../images/regis/tipregistit.jpg)*/ + +/*}*/ .registrationbackcenter { display: flex; @@ -26,14 +27,14 @@ align-items: center; } -.registrationback1 { - height: 368px; - width: 1200px; - border: 0.5px solid; - display: flex; - flex-direction: column; - background: #0dcecb; -} +/*.registrationback1 {*/ +/* height: 368px;*/ +/* width: 1200px;*/ +/* border: 0.5px solid;*/ +/* display: flex;*/ +/* flex-direction: column;*/ +/* background:url(../../../../../images/regis/tipregistit.jpg)*/ +/*}*/ .registrationbackp1 { color: #ffffff; @@ -301,14 +302,40 @@ .regitem { display: flex; flex-direction: initial; - border-bottom: 1px solid #EDEDED; margin-top: 44px; } -.regitem2 { +.regitem22 { display: flex; flex-direction: initial; + margin-top: 27px; + margin-bottom: 19px; +} + +.yslborderbottom { border-bottom: 1px solid #EDEDED; +} + +.registrationback { + height: 368px; + width: 1200px; + display: flex; + display: -webkit-flex; + flex-direction: column; + align-items: center; +} + +.registrationback1 { + height: 368px; + width: 1200px; + display: flex; + flex-direction: column; +} + +.regitem2 { + display: flex; + flex-direction: initial; + padding-bottom: 18px; margin-top: 19px; } @@ -328,18 +355,21 @@ align-items: center; justify-content: center; margin-left: 26px; - padding-bottom: 18px; + } .regitemimg2 { height: 78px; width: 78px; + background-color: transparent; + margin-bottom: 9px; + border-radius: 50%; } .personregitemimg { - border: 0.5px solid; height: 64px; width: 64px; + border-radius: 50%; } @@ -353,6 +383,8 @@ width: 69px; height: 69px; margin-top: 3px; + background-color: transparent; + border-radius: 50%; } @@ -360,7 +392,9 @@ margin-top: 16px; width: 49px; height: 51px; - margin-left: 25px + margin-left: 25px; + border-radius: 50%; + } .regitemimgs22 { @@ -368,6 +402,8 @@ width: 28px; height: 28px; margin-left: 20px; + border-radius: 50%; + } .regitemimgs3 { @@ -375,7 +411,7 @@ height: 22px; width: 22px; font-size: 21px !important; - margin-top: 22px; + margin-top: 21px; color: #1C91E8; } @@ -714,4 +750,32 @@ reglistviewdivs2 { line-height: 30px; border-radius: 2px; } -/*PersonalModalteam.js*/ \ No newline at end of file +/*PersonalModalteam.js*/ + + +/*文字长度限制*/ +.maxnamewidth100 { + max-width: 100px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + cursor: default; +} + +.maxnamewidth160 { + max-width: 160px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + cursor: default; +} + +.maxnamewidth134 { + max-width: 134px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + cursor: default; +} + +/*文字长度限制?*/ \ No newline at end of file diff --git a/public/react/src/modules/competition/competmodal/ExittheteamModel.js b/public/react/src/modules/competition/competmodal/ExittheteamModel.js new file mode 100644 index 000000000..29eab7b50 --- /dev/null +++ b/public/react/src/modules/competition/competmodal/ExittheteamModel.js @@ -0,0 +1,59 @@ +import React, {Component} from 'react'; +import {getImageUrl} from 'educoder'; +import {Modal, Input, Spin, Tooltip, Icon, Dropdown, Button} from 'antd'; +import axios from 'axios'; +import competition from '../comcss/competition.css'; +import Registrationitem from "../Registrationitem"; +import InfiniteScroll from 'react-infinite-scroller'; +// import PersonModaltion from "./PersonModaltion"; +const {Search} = Input; + +//退出战队 +class ExittheteamModel extends React.Component { + + constructor(props) { + super(props); + this.state = {} + } + + + render() { + const { + addonAfter, test, test3, Numberofteammentors, Thecurrentnumber, person1, person2 + } = this.state; + //Modal + //keyboard是否支持键盘 esc 关闭 + //closable 是否显示右上角的关闭按钮 + //底部内容,当不需要默认底部按钮时,可以设为 footer={null} + //destroyOnClose 关闭时销毁 Modal 里的子元素 + //centered 垂直居中展示 Modal + //visible 弹出框是否显示 + + return ( + + + +
+
{this.props.exitintpermessages}
+
+ + +
+ ) + } +} + +export default ExittheteamModel; diff --git a/public/react/src/modules/competition/competmodal/PersonModal.js b/public/react/src/modules/competition/competmodal/PersonModal.js index 0b4e988a0..53091d5e5 100644 --- a/public/react/src/modules/competition/competmodal/PersonModal.js +++ b/public/react/src/modules/competition/competmodal/PersonModal.js @@ -56,14 +56,64 @@ class PersonModal extends Component { } } componentDidMount() { + var data = []; + var polls_nametests = ""; + var datas = { + enrollable: false, + id: this.props.user.user_id, + name: this.props.user.real_name, + school_name: this.props.user.user_school, + student_id: null, + identity: this.props.user.user_identity, + type: "导师", + }; + data.push(datas); + + // console.log("itemiddata"); + // console.log("编辑战队") + // console.log(this.props.itemiddata); + try { + if (this.props.Newtit === false) { + for (var i = 0; i < this.props.itemiddata.team_members.length; i++) { + if (i === 0) { + ///因为第一个位置是创建者 所以要过滤掉 + } else { + var datasy = { + enrollable: false, + id: this.props.itemiddata.team_members[i].user_id, + name: this.props.itemiddata.team_members[i].name, + school_name: this.props.itemiddata.team_members[i].school_name, + student_id: null, + identity: this.props.itemiddata.team_members[i].identity, + type: this.props.itemiddata.team_members[i].role === "teacher" ? "导师" : "队员", + }; + data.push(datasy); + } + } + if (this.props.itemiddata) { + polls_nametests = this.props.itemiddata.name; + } + } + } catch (e) { + + } + + this.setState({ + myuser: this.props.user, + mydatas: data, + polls_nametest: polls_nametests + }) + this.setState({ + GetenrollmentAPI: this.props.GetenrollmentAPI, + }) } componentDidUpdate = (prevProps) => { if (prevProps.user != this.props.user) { - console.log("Registration.js componentDidUpdate"); - console.log(this.props); - //console.log(prevProps); + ////console.log("Registration.js componentDidUpdate"); + ////console.log(this.props); + // ////console.log(prevProps); //identity职场称 //user_school学校 //real_name姓名 @@ -76,7 +126,7 @@ class PersonModal extends Component { school_name: this.props.user.user_school, student_id: null, identity: this.props.user.user_identity, - type: "创建者", + type: "导师", }; data.push(datas); this.setState({ @@ -86,8 +136,8 @@ class PersonModal extends Component { } if (prevProps.GetenrollmentAPI != this.props.GetenrollmentAPI) { - console.log("Registration.js GetenrollmentAPIcomponentDidUpdate"); - console.log(this.props); + ////console.log("Registration.js GetenrollmentAPIcomponentDidUpdate"); + ////console.log(this.props); this.setState({ GetenrollmentAPI: this.props.GetenrollmentAPI, }) @@ -95,6 +145,8 @@ class PersonModal extends Component { }; //创建战队 Createateam = () => { + + const {polls_nametest, mydatas, GetenrollmentAPI} = this.state; var myteaherdata = []; var myshtudentdata = []; @@ -102,85 +154,93 @@ class PersonModal extends Component { for (var a = 0; a < mydatas.length; a++) { if (mydatas[a].type === "导师") { i++; - var objectt = { - enrollable: mydatas[a].enrollable, - id: mydatas[a].id, - identity: mydatas[a].identity, - name: mydatas[a].name, - school_name: mydatas[a].school_name, - } - myteaherdata.push(objectt); + // var objectt = { + // enrollable: mydatas[a].enrollable, + // id: mydatas[a].id, + // identity: mydatas[a].identity, + // name: mydatas[a].name, + // school_name: mydatas[a].school_name, + // } + myteaherdata.push(mydatas[a].id); } else if (mydatas[a].type === "队员") { - var objectts = { - enrollable: mydatas[a].enrollable, - id: mydatas[a].id, - name: mydatas[a].name, - school_name: mydatas[a].school_name, - student_id: mydatas[a].student_id, - } - myshtudentdata.push(objectts); + // var objectts = { + // enrollable: mydatas[a].enrollable, + // id: mydatas[a].id, + // name: mydatas[a].name, + // school_name: mydatas[a].school_name, + // student_id: mydatas[a].student_id, + // } + myshtudentdata.push(mydatas[a].id); } } - if (GetenrollmentAPI !== undefined || GetenrollmentAPI !== null) { - if (GetenrollmentAPI.teacher_staff !== undefined || GetenrollmentAPI.teacher_staff !== null) { - if (GetenrollmentAPI.teacher_staff.minimum > i) { - this.setState({ - Thecurrentnumberbool: true, - Thecurrentnumber: i, - booltech: false, - boolstud: false - }) - return - } else if (GetenrollmentAPI.teacher_staff.maximum < i) { - this.setState({ - Thecurrentnumberbool: true, - Thecurrentnumber: i, - booltech: false, - boolstud: false - }) - return - } - } - } - // Thecurrentnumber - let url = `/competitions/${"gcc-course-2019"}/competition_teams.json`; - axios.post(url, { - name: polls_nametest, - teacher_ids: myteaherdata, - member_ids: myshtudentdata, - }).then((result) => { - //console.log("获取到创建战队的数据"); - //console.log(result); - if (result) { - if (result.data) { - this.props.Tmoconfirm1(true); + try { + if (GetenrollmentAPI) { + if (GetenrollmentAPI.teacher_staff) { + if (GetenrollmentAPI.teacher_staff.minimum > i) { + this.setState({ + Thecurrentnumberbool: true, + Thecurrentnumber: i, + booltech: false, + boolstud: false + }) + return + } else if (GetenrollmentAPI.teacher_staff.maximum < i) { + this.setState({ + Thecurrentnumberbool: true, + Thecurrentnumber: i, + booltech: false, + boolstud: false + }) + return + } + } } - }).catch((error) => { - //console.log(error) - }); - - } - creident = (name, teacher_ids, member_ids) => { - let collaborators = `/competitions/${"gcc-course-2019"}/competition_teams.json`; - axios.post(collaborators, { - name: name, - teacher_ids: teacher_ids, - member_ids: member_ids, - }).then((result) => { - if (result) { - if (result.data) { + } catch (e) { + } + // Thecurrentnumber + if (this.props.Newtit === true) { + //创建新的战队 + let url = `/competitions/${this.props.match.params.identifier}/competition_teams.json`; + axios.post(url, { + name: polls_nametest, + teacher_ids: myteaherdata, + member_ids: myshtudentdata, + }).then((result) => { + // ////console.log("获取到创建战队的数据"); + // ////console.log(result); + if (result) { + if (result.data) { + this.props.Tmoconfirm1(true); + } } - } - }).catch((error) => { - //console.log(error) - }); + }).catch((error) => { + // ////console.log(error) + }); + } else { + //编辑战队 + let url = `/competitions/${this.props.match.params.identifier}/competition_teams/${this.props.itemiddata.id}.json`; + axios.put(url, { + name: polls_nametest, + teacher_ids: myteaherdata, + member_ids: myshtudentdata, + }).then((result) => { + // ////console.log("获取到编辑战队的数据"); + // ////console.log(result); + if (result) { + if (result.data) { + this.props.Tmoconfirm1(true); + } + } + }).catch((error) => { + // ////console.log(error) + }); + } } - Getteacherdata = (keywordteachers, team_idteachers, teacher_ids) => { this.setState({ person1: true, @@ -189,24 +249,24 @@ class PersonModal extends Component { //老师姓名 keyword //当前战队ID team_id //当前老师ID数组 teacher_ids - //console.log("搜索的老师"); + // ////console.log("搜索的老师"); const datas = { keyword: keywordteachers, team_id: team_idteachers, teacher_ids: teacher_ids, }; - let url = `/competitions/${"gcc-course-2019"}/teachers.json`; + let url = `/competitions/${this.props.match.params.identifier}/teachers.json`; axios.get((url), {params: datas}).then((result) => { if (result) { if (result.data) { - //console.log(result); + // ////console.log(result); this.setState({ teacher_ids: result.data.teachers }) } } }).catch((error) => { - //console.log(error); + // ////console.log(error); }) }; Getstudentsdata = (keywordstudents, team_idstudents, student_ids) => { @@ -217,17 +277,17 @@ class PersonModal extends Component { //学生姓名 keyword //当前战队ID team_id //当前队员ID数组 student_ids - //console.log("搜索的学生"); + // ////console.log("搜索的学生"); const datas = { keyword: keywordstudents, team_id: team_idstudents, student_ids: student_ids, }; - let url = `/competitions/${"gcc-course-2019"}/students.json`; + let url = `/competitions/${this.props.match.params.identifier}/students.json`; axios.get((url), {params: datas}).then((result) => { if (result) { if (result.data) { - //console.log(result); + // ////console.log(result); this.setState({ member_ids: result.data.teachers }) @@ -235,14 +295,14 @@ class PersonModal extends Component { } } }).catch((error) => { - //console.log(error); + // ////console.log(error); }) }; //老师输入框事件 teacheronChange = (e) => { - //console.log(e.target.value); - //console.log("老师输入框事件|||||||||||123123123"); + // ////console.log(e.target.value); + // ////console.log("老师输入框事件|||||||||||123123123"); this.setState({ keywordteachers: e.target.value, booltech: false, @@ -280,8 +340,8 @@ class PersonModal extends Component { //学生输入框事件 studentsonChange = (e) => { - //console.log("学生输入框事件"); - //console.log(e); + // ////console.log("学生输入框事件"); + // ////console.log(e); this.setState({ keywordstudents: e.target.value, boolstud: false, @@ -331,9 +391,9 @@ class PersonModal extends Component { }; var fordabool = false; var forda = this.state.mydatas; - //console.log("点击获取老师数据"); - //console.log(object); - //console.log(forda); + // ////console.log("点击获取老师数据"); + // ////console.log(object); + // ////console.log(forda); for (var i = 0; i < forda.length; i++) { if (forda[i].id) { if (forda[i].id === object.id) { @@ -372,14 +432,14 @@ class PersonModal extends Component { }; var fordabool = false; var forda = this.state.mydatas; - //console.log("点击获取学生数据2"); - //console.log(object); - //console.log(forda); + // ////console.log("点击获取学生数据2"); + // ////console.log(object); + // ////console.log(forda); for (var i = 0; i < forda.length; i++) { if (forda[i].id) { - // //console.log(true); - // //console.log(forda[i].id); - // //console.log(object.id); + // // ////console.log(true); + // // ////console.log(forda[i].id); + // // ////console.log(object.id); if (forda[i].id === object.id) { fordabool = true; break @@ -407,7 +467,7 @@ class PersonModal extends Component { } //输入框事件 changeTopicName = (e) => { - // //console.log("调用了changeTopicName"); + // // ////console.log("调用了changeTopicName"); let num = parseInt(e.target.value.length); if (num > 60) { return; @@ -422,7 +482,7 @@ class PersonModal extends Component { //onSearchsou onSearch = (value) => { - //console.log("搜索的数据" + value); + // ////console.log("搜索的数据" + value); }; handleInfiniteOnLoad = () => { // this.setState({ @@ -442,12 +502,12 @@ class PersonModal extends Component { } handleInfiniteOnLoad1 = () => { - // //console.log("调用了方法1111"); + // // ////console.log("调用了方法1111"); // this.setState({ // loading1: true, // }) // setTimeout(() => { - // //console.log("调用了方法11112"); + // // ////console.log("调用了方法11112"); // this.setState({ // loading1: false, // hasMore: true, @@ -456,13 +516,13 @@ class PersonModal extends Component { } handleInfiniteOnLoad2 = () => { - // //console.log("调用了方法1111"); + // // ////console.log("调用了方法1111"); // this.setState({ // loading2: true, // // }) // setTimeout(() => { - // //console.log("调用了方法11113"); + // // ////console.log("调用了方法11113"); // this.setState({ // hasMore: true, // loading2: false, @@ -471,23 +531,23 @@ class PersonModal extends Component { } inputOnBlur = (e) => { - //console.log("inputOnBlur"); - //console.log(e); + // ////console.log("inputOnBlur"); + // ////console.log(e); this.setState({ person1: false }) } inputOnBlur2 = (e) => { - //console.log("inputOnBlur"); - //console.log(e); + // ////console.log("inputOnBlur"); + // ////console.log(e); this.setState({ person2: false }) } startSearch = (e) => { - //console.log("startSearch"); - //console.log(e); + // ////console.log("startSearch"); + // ////console.log(e); this.setState({ person1: true, person2: false, @@ -497,8 +557,8 @@ class PersonModal extends Component { } startSearch2 = (e) => { - //console.log("startSearch2"); - //console.log(e); + // ////console.log("startSearch2"); + // ////console.log(e); this.setState({ person1: false, person2: true, @@ -508,8 +568,8 @@ class PersonModal extends Component { } inputOnFocus = (e) => { - //console.log("inputOnFocus"); - //console.log(e); + // ////console.log("inputOnFocus"); + // ////console.log(e); try { if (this.state.keywordteachers && this.state.keywordteachers.length > 0) { this.setState({ @@ -533,8 +593,8 @@ class PersonModal extends Component { } inputOnFocus2 = (e) => { - //console.log("inputOnFocus2"); - //console.log(e); + // ////console.log("inputOnFocus2"); + // ////console.log(e); try { if (this.state.keywordstudents && this.state.keywordstudents.length > 0) { this.setState({ @@ -559,8 +619,8 @@ class PersonModal extends Component { } inputOnFocus3 = (e) => { - //console.log("inputOnFocus3"); - //console.log(e); + // ////console.log("inputOnFocus3"); + // ////console.log(e); this.setState({ person2: false, person1: false, @@ -570,13 +630,13 @@ class PersonModal extends Component { var {mydatas} = this.state; if (item) { var pos = mydatas.indexOf(item); - // console.log("deletedata"); - // console.log(pos); + // ////console.log("deletedata"); + // ////console.log(pos); var removedItem = mydatas.splice(pos, 1); - // console.log("deletedata22222"); - // console.log(removedItem) + // ////console.log("deletedata22222"); + // ////console.log(removedItem) //removedItem 是被删除的元素 - // console.log(mydatas) + // ////console.log(mydatas) this.setState({ mydatas: mydatas, }) @@ -610,11 +670,21 @@ class PersonModal extends Component { textAlign: "center", }} >{item.name === undefined || item.name === null || item.name === "" ? "--" : item.name}

-

{item.type === undefined || item.type === null || item.type === "" ? "--" : item.type}

+ { + index === 0 ? +

创建者

+ : +

{item.type === undefined || item.type === null || item.type === "" ? "--" : item.type}

+ } +

{item.identity === undefined || item.identity === null || item.identity === "" ? "--" : item.identity}

-

{item.type && item.type === "创建者" ? "" : - this.deletedata(item)}/>}

+ { + index === 0 ? +

+ : +

this.deletedata(item)}/>

+ }
); var cpersondiv1Items = []; @@ -764,6 +842,8 @@ class PersonModal extends Component {
); + //console.log("PersonModal"); + //console.log(this.props); return ( { ` - .reglistviewdivss2 a:hover + a:hover { background-color:#F6F4F4; } @@ -841,6 +921,7 @@ class PersonModal extends Component {

diff --git a/public/react/src/modules/competition/competmodal/PersonModaltion.js b/public/react/src/modules/competition/competmodal/PersonModaltion.js index e8e4148ee..680566297 100644 --- a/public/react/src/modules/competition/competmodal/PersonModaltion.js +++ b/public/react/src/modules/competition/competmodal/PersonModaltion.js @@ -9,7 +9,6 @@ import moment from 'moment'; import competition from './comcss/competition.css'; import {Checkbox, Table, Pagination, Menu, Icon} from "antd"; // 团队竞赛报名无报名子组件团队 在线竞赛 > 全国高校计算机大赛-项目挑战> -import Rectanglex from "../../modules/competition/Rectanglex.png"; class PersonModaltion extends React.Component { constructor(props) { diff --git a/public/react/src/modules/competition/competmodal/PersonalModalteam.js b/public/react/src/modules/competition/competmodal/PersonalModalteam.js index acba9c1b8..f86668f34 100644 --- a/public/react/src/modules/competition/competmodal/PersonalModalteam.js +++ b/public/react/src/modules/competition/competmodal/PersonalModalteam.js @@ -20,7 +20,7 @@ class PersonalModalteam extends Component { Tmoconfirmto = () => { - let url = `/competitions/${"gcc-course-2019"}/competition_teams/join.json`; + let url = `/competitions/${this.props.match.params.identifier}/competition_teams/join.json`; axios.post(url, { invite_code: this.state.yslzxueshiskmcdm1 }).then((result) => { diff --git a/public/react/src/modules/competition/personal/PersonalCompetit.js b/public/react/src/modules/competition/personal/PersonalCompetit.js index b14ad4d36..d740e416a 100644 --- a/public/react/src/modules/competition/personal/PersonalCompetit.js +++ b/public/react/src/modules/competition/personal/PersonalCompetit.js @@ -58,7 +58,7 @@ class PersonalCompetit extends React.Component {
-

参赛总人数:132

+

参赛总人数:132

: ""} diff --git a/public/react/src/modules/competition/personal/PersonalCompetititem.js b/public/react/src/modules/competition/personal/PersonalCompetititem.js index ed4b76628..bd6a092eb 100644 --- a/public/react/src/modules/competition/personal/PersonalCompetititem.js +++ b/public/react/src/modules/competition/personal/PersonalCompetititem.js @@ -9,8 +9,18 @@ import moment from 'moment'; import {SnackbarHOC, WordsBtn, getImageUrl} from 'educoder'; import {TPMIndexHOC} from '../../tpm/TPMIndexHOC'; import competition from '../comcss/competition.css'; -import {Button} from 'antd'; +import {Button, message} from 'antd'; +// 点击按钮复制功能 +function jsCopy() { + var e = document.getElementById("copy_invite_code"); + e.select(); + document.execCommand("Copy"); + codesuccess() +} +function codesuccess() { + message.success('复制成功'); +}; // 团队竞赛报名无报名子组件团队 竞赛报名-已创建战队 class PersonalCompetititem extends React.Component { constructor(props) { @@ -22,7 +32,7 @@ class PersonalCompetititem extends React.Component { } componentDidMount() { - // //console.log(this.props.data) + // // ////console.log(this.props.data) this.setState({ data: this.props.data, }) @@ -37,21 +47,24 @@ class PersonalCompetititem extends React.Component { } render() { - const {data} = this.state; - //console.log("PersonalCompetititem"); - //console.log(data); - //console.log(data[0]); - //console.log(data&&data[0].creator.image_url); + const {data} = this.props; + // ////console.log("PersonalCompetititem"); + // ////console.log(data); + // ////console.log(data[0]); + // ////console.log(data&&data[0].creator.image_url); // const listItems = mydatas.map((item, index) => // // ); + // console.log("PersonalCompetititem"); + // console.log(data); return (
{ - data && data[0] ?
-
+
+
@@ -61,7 +74,7 @@ class PersonalCompetititem extends React.Component { width: "78px", textAlign: "center" - }}>{data && data[0].name}

+ }}>{data[0].creator.name}

{data && data[0].school_name}

+ }}>{data[0].name}

: index === 1 ? -
+ -
+ : index === 2 ? -
+ -
+ : index === 3 ? -
+ -
+ : index === 4 ? -
+ -
+ : index === 5 ? +
+ -
+ -
- : -
+ +
+ : "" ) }) } @@ -122,19 +138,46 @@ class PersonalCompetititem extends React.Component {
-

+ 邀请码: + 邀请码:yngh5

+ }}>{data[0].invite_code === null || data[0].invite_code === undefined ? "" : data[0].invite_code} +
+
+ +
- - + {data[0].invite_code === null || data[0].invite_code === undefined ? + + + : + { + jsCopy() + }} + > + + + } + { this.props.type === 5 ?
-
-

删除战队

+
this.props.Exittheteamshow(data[0].id, true)}> +

this.props.Exittheteamshow(data[0].id, true)}>删除战队

-
-

编辑战队

+
this.props.Createateamedit(data[0])}> +

this.props.Createateamedit(data[0])}>编辑战队

: this.props.type === 2 ? -
-

战队详情

+ 战队详情
-
-

退出战队

+
this.props.Exittheteamshow(data[0].id, false)}> +

this.props.Exittheteamshow(data[0].id, false)}>退出战队

@@ -172,8 +220,8 @@ class PersonalCompetititem extends React.Component { }} > -
-

退出战队

+
this.props.Exittheteamshow(data[0].id, false)}> +

this.props.Exittheteamshow(data[0].id, false)}>退出战队

@@ -182,6 +230,7 @@ class PersonalCompetititem extends React.Component { }
+
: "" }
diff --git a/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js b/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js index 7f3b4bfce..61e6419b7 100644 --- a/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js +++ b/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js @@ -1,14 +1,10 @@ import React, { Component } from 'react'; import { Link } from 'react-router-dom'; import { Menu, Icon, List, Avatar,Row, Col,Tag,Pagination} from 'antd'; +import {getImageUrl} from 'educoder'; import axios from 'axios'; import './Competitionsindex.css'; -import NoneData from "../../courses/shixunHomework/shixunHomework"; -import groups1 from './groups1.png'; -import groups2 from './groups2.png'; -import groups3 from './groups3.png'; - - +import NoneData from "../../courses/coursesPublic/NoneData"; const { SubMenu } = Menu; @@ -42,7 +38,7 @@ class CompetitionsIndex extends Component{ axios.get(Url,{params:{ category:category, page:page, - per_page:6, + per_page:15, } }).then((response) => { if(response.status===200){ @@ -66,17 +62,45 @@ class CompetitionsIndex extends Component{ this.getdata(e.key,page) }; - render() { - let {datas,page,count}=this.state; - + setcompetitonurl=(url)=>{ + if(url!=null){ + this.props.history.replace(url); + } + } + PaginationCourse=(pageNumber)=>{ + let {category}=this.state; + this.setState({ + page: pageNumber, + }) + this.getdata(category,pageNumber); + } + render() { + let {datas,page,count}=this.state; + admin: true + business: false + console.log(this.props.current_user&&this.props.current_user.business) return (
-
+ +
@@ -102,28 +126,13 @@ class CompetitionsIndex extends Component{
- - ( - +
{item.description===null||item.description===undefined||item.description===""?:""} + src={item.competition_status==="ended"?getImageUrl(`images/educoder/competitions/groups1.png`):item.competition_status==="nearly_published"?getImageUrl(`images/educoder/competitions/groups2.png`):item.competition_status==="progressing"?getImageUrl(`images/educoder/competitions/groups3.png`):""} /> ¥{item.bonus}
+ + + + + + ) + } +} +export default CompetitionContents; \ No newline at end of file diff --git a/public/react/src/modules/competitions/Competitions.js b/public/react/src/modules/competitions/Competitions.js index 3d5bcd920..1b8da55d7 100644 --- a/public/react/src/modules/competitions/Competitions.js +++ b/public/react/src/modules/competitions/Competitions.js @@ -29,6 +29,11 @@ const CompetitionTeams = Loadable({ loading: Loading, }) +//团队竞赛报名 +const Registration = Loadable({ + loader: () => import('../competition/Registration'), + loading: Loading, +}); class Competitions extends Component { constructor(props) { @@ -36,6 +41,8 @@ class Competitions extends Component { } componentDidMount(){ + console.log("Competitions竞赛"); + console.log(this.props); window.document.title = '竞赛'; } @@ -53,6 +60,15 @@ class Competitions extends Component { } > + + {/*新版竞赛报名*/} + () + } + /> + {/*新版竞赛详情页面*/}