mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-19 16:01:34 +02:00
Added support for creating payments through the API
This commit is contained in:
parent
6455bf757b
commit
39ba8d1287
@ -1,8 +1,10 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Input;
|
||||||
use Utils;
|
use Utils;
|
||||||
use Response;
|
use Response;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
|
use App\Models\Invoice;
|
||||||
use App\Ninja\Repositories\PaymentRepository;
|
use App\Ninja\Repositories\PaymentRepository;
|
||||||
|
|
||||||
class PaymentApiController extends Controller
|
class PaymentApiController extends Controller
|
||||||
@ -16,7 +18,10 @@ class PaymentApiController extends Controller
|
|||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$payments = Payment::scope()->with('client', 'contact', 'invitation', 'user', 'invoice')->orderBy('created_at', 'desc')->get();
|
$payments = Payment::scope()
|
||||||
|
->with('client', 'contact', 'invitation', 'user', 'invoice')
|
||||||
|
->orderBy('created_at', 'desc')
|
||||||
|
->get();
|
||||||
$payments = Utils::remapPublicIds($payments);
|
$payments = Utils::remapPublicIds($payments);
|
||||||
|
|
||||||
$response = json_encode($payments, JSON_PRETTY_PRINT);
|
$response = json_encode($payments, JSON_PRETTY_PRINT);
|
||||||
@ -25,15 +30,38 @@ class PaymentApiController extends Controller
|
|||||||
return Response::make($response, 200, $headers);
|
return Response::make($response, 200, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
public function store()
|
|
||||||
{
|
|
||||||
$data = Input::all();
|
|
||||||
$invoice = $this->invoiceRepo->save(false, $data, false);
|
|
||||||
|
|
||||||
$response = json_encode($invoice, JSON_PRETTY_PRINT);
|
public function store()
|
||||||
$headers = Utils::getApiHeaders();
|
{
|
||||||
return Response::make($response, 200, $headers);
|
$data = Input::all();
|
||||||
}
|
$error = false;
|
||||||
*/
|
|
||||||
|
if (isset($data['invoice_id'])) {
|
||||||
|
$invoice = Invoice::scope($data['invoice_id'])->with('client')->first();
|
||||||
|
|
||||||
|
if ($invoice) {
|
||||||
|
$data['invoice'] = $invoice->public_id;
|
||||||
|
$data['client'] = $invoice->client->public_id;
|
||||||
|
} else {
|
||||||
|
$error = trans('validation.not_in', ['attribute' => 'invoice_id']);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$error = trans('validation.not_in', ['attribute' => 'invoice_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($data['transaction_reference'])) {
|
||||||
|
$data['transaction_reference'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$payment = $this->paymentRepo->save(false, $data);
|
||||||
|
$payment = Payment::scope($payment->public_id)->with('client', 'contact', 'user', 'invoice')->first();
|
||||||
|
|
||||||
|
$payment = Utils::remapPublicIds([$payment]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = json_encode($error ?: $payment, JSON_PRETTY_PRINT);
|
||||||
|
$headers = Utils::getApiHeaders();
|
||||||
|
return Response::make($response, 200, $headers);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,14 @@ class PaymentRepository
|
|||||||
$payment->payment_type_id = $paymentTypeId;
|
$payment->payment_type_id = $paymentTypeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
$payment->payment_date = Utils::toSqlDate($input['payment_date']);
|
if (isset($input['payment_date_sql'])) {
|
||||||
|
$payment->payment_date = $input['payment_date_sql'];
|
||||||
|
} elseif (isset($input['payment_date'])) {
|
||||||
|
$payment->payment_date = Utils::toSqlDate($input['payment_date']);
|
||||||
|
} else {
|
||||||
|
$payment->payment_date = date('Y-m-d');
|
||||||
|
}
|
||||||
|
|
||||||
$payment->transaction_reference = trim($input['transaction_reference']);
|
$payment->transaction_reference = trim($input['transaction_reference']);
|
||||||
|
|
||||||
if (!$publicId) {
|
if (!$publicId) {
|
||||||
|
26
bower.json
26
bower.json
@ -2,22 +2,22 @@
|
|||||||
"name": "hillelcoren/invoice-ninja",
|
"name": "hillelcoren/invoice-ninja",
|
||||||
"version": "0.9.0",
|
"version": "0.9.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jquery": "~1.11",
|
"jquery": "1.11.3",
|
||||||
"bootstrap": "~3.*",
|
"bootstrap": "3.3.1",
|
||||||
"jquery-ui": "~1.*",
|
"jquery-ui": "1.11.2",
|
||||||
"datatables": "1.10.4",
|
"datatables": "1.10.4",
|
||||||
"datatables-bootstrap3": "*",
|
"datatables-bootstrap3": "*",
|
||||||
"knockout.js": "~3.*",
|
"knockout.js": "3.1.0",
|
||||||
"knockout-mapping": "*",
|
"knockout-mapping": "2.4.1",
|
||||||
"knockout-sortable": "*",
|
"knockout-sortable": "0.9.3",
|
||||||
"font-awesome": "~4.*",
|
"font-awesome": "~4.*",
|
||||||
"underscore": "~1.*",
|
"underscore": "1.7.0",
|
||||||
"jspdf": "*",
|
"jspdf": "1.0.272",
|
||||||
"bootstrap-datepicker": "~1.*",
|
"bootstrap-datepicker": "1.4.0",
|
||||||
"typeahead.js": "~0.9.3",
|
"typeahead.js": "0.9.3",
|
||||||
"accounting": "~0.*",
|
"accounting": "0.3.2",
|
||||||
"spectrum": "~1.3.4",
|
"spectrum": "1.3.4",
|
||||||
"d3": "~3.4.11",
|
"d3": "3.4.11",
|
||||||
"handsontable": "*",
|
"handsontable": "*",
|
||||||
"pdfmake": "*",
|
"pdfmake": "*",
|
||||||
"moment": "*"
|
"moment": "*"
|
||||||
|
60
public/css/built.css
vendored
60
public/css/built.css
vendored
File diff suppressed because one or more lines are too long
4
public/css/built.public.css
vendored
4
public/css/built.public.css
vendored
File diff suppressed because one or more lines are too long
@ -27152,31 +27152,13 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
}
|
}
|
||||||
}.call(this));
|
}.call(this));
|
||||||
|
|
||||||
/* =========================================================
|
/*!
|
||||||
* bootstrap-datepicker.js
|
* Datepicker for Bootstrap v1.4.0 (https://github.com/eternicode/bootstrap-datepicker)
|
||||||
* Repo: https://github.com/eternicode/bootstrap-datepicker/
|
|
||||||
* Demo: http://eternicode.github.io/bootstrap-datepicker/
|
|
||||||
* Docs: http://bootstrap-datepicker.readthedocs.org/
|
|
||||||
* Forked from http://www.eyecon.ro/bootstrap-datepicker
|
|
||||||
* =========================================================
|
|
||||||
* Started by Stefan Petre; improvements by Andrew Rowls + contributors
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Copyright 2012 Stefan Petre
|
||||||
* you may not use this file except in compliance with the License.
|
* Improvements by Andrew Rowls
|
||||||
* You may obtain a copy of the License at
|
* Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)
|
||||||
*
|
*/(function($, undefined){
|
||||||
* 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($, undefined){
|
|
||||||
|
|
||||||
var $window = $(window);
|
|
||||||
|
|
||||||
function UTCDate(){
|
function UTCDate(){
|
||||||
return new Date(Date.UTC.apply(Date, arguments));
|
return new Date(Date.UTC.apply(Date, arguments));
|
||||||
@ -27185,6 +27167,13 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
var today = new Date();
|
var today = new Date();
|
||||||
return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());
|
return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());
|
||||||
}
|
}
|
||||||
|
function isUTCEquals(date1, date2) {
|
||||||
|
return (
|
||||||
|
date1.getUTCFullYear() === date2.getUTCFullYear() &&
|
||||||
|
date1.getUTCMonth() === date2.getUTCMonth() &&
|
||||||
|
date1.getUTCDate() === date2.getUTCDate()
|
||||||
|
);
|
||||||
|
}
|
||||||
function alias(method){
|
function alias(method){
|
||||||
return function(){
|
return function(){
|
||||||
return this[method].apply(this, arguments);
|
return this[method].apply(this, arguments);
|
||||||
@ -27238,16 +27227,16 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
// Picker object
|
// Picker object
|
||||||
|
|
||||||
var Datepicker = function(element, options){
|
var Datepicker = function(element, options){
|
||||||
this.dates = new DateArray();
|
|
||||||
this.viewDate = UTCToday();
|
|
||||||
this.focusDate = null;
|
|
||||||
|
|
||||||
this._process_options(options);
|
this._process_options(options);
|
||||||
|
|
||||||
|
this.dates = new DateArray();
|
||||||
|
this.viewDate = this.o.defaultViewDate;
|
||||||
|
this.focusDate = null;
|
||||||
|
|
||||||
this.element = $(element);
|
this.element = $(element);
|
||||||
this.isInline = false;
|
this.isInline = false;
|
||||||
this.isInput = this.element.is('input');
|
this.isInput = this.element.is('input');
|
||||||
this.component = this.element.is('.date') ? this.element.find('.add-on, .input-group-addon, .btn') : false;
|
this.component = this.element.hasClass('date') ? this.element.find('.add-on, .input-group-addon, .btn') : false;
|
||||||
this.hasInput = this.component && this.element.find('input').length;
|
this.hasInput = this.component && this.element.find('input').length;
|
||||||
if (this.component && this.component.length === 0)
|
if (this.component && this.component.length === 0)
|
||||||
this.component = false;
|
this.component = false;
|
||||||
@ -27270,7 +27259,7 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
this.viewMode = this.o.startView;
|
this.viewMode = this.o.startView;
|
||||||
|
|
||||||
if (this.o.calendarWeeks)
|
if (this.o.calendarWeeks)
|
||||||
this.picker.find('tfoot th.today, tfoot th.clear')
|
this.picker.find('tfoot .today, tfoot .clear')
|
||||||
.attr('colspan', function(i, val){
|
.attr('colspan', function(i, val){
|
||||||
return parseInt(val) + 1;
|
return parseInt(val) + 1;
|
||||||
});
|
});
|
||||||
@ -27280,6 +27269,7 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
this.setStartDate(this._o.startDate);
|
this.setStartDate(this._o.startDate);
|
||||||
this.setEndDate(this._o.endDate);
|
this.setEndDate(this._o.endDate);
|
||||||
this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);
|
this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);
|
||||||
|
this.setDatesDisabled(this.o.datesDisabled);
|
||||||
|
|
||||||
this.fillDow();
|
this.fillDow();
|
||||||
this.fillMonths();
|
this.fillMonths();
|
||||||
@ -27346,8 +27336,6 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
o.multidate = Number(o.multidate) || false;
|
o.multidate = Number(o.multidate) || false;
|
||||||
if (o.multidate !== false)
|
if (o.multidate !== false)
|
||||||
o.multidate = Math.max(0, o.multidate);
|
o.multidate = Math.max(0, o.multidate);
|
||||||
else
|
|
||||||
o.multidate = 1;
|
|
||||||
}
|
}
|
||||||
o.multidateSeparator = String(o.multidateSeparator);
|
o.multidateSeparator = String(o.multidateSeparator);
|
||||||
|
|
||||||
@ -27385,10 +27373,20 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
return parseInt(d, 10);
|
return parseInt(d, 10);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
o.datesDisabled = o.datesDisabled||[];
|
||||||
|
if (!$.isArray(o.datesDisabled)) {
|
||||||
|
var datesDisabled = [];
|
||||||
|
datesDisabled.push(DPGlobal.parseDate(o.datesDisabled, format, o.language));
|
||||||
|
o.datesDisabled = datesDisabled;
|
||||||
|
}
|
||||||
|
o.datesDisabled = $.map(o.datesDisabled,function(d){
|
||||||
|
return DPGlobal.parseDate(d, format, o.language);
|
||||||
|
});
|
||||||
|
|
||||||
var plc = String(o.orientation).toLowerCase().split(/\s+/g),
|
var plc = String(o.orientation).toLowerCase().split(/\s+/g),
|
||||||
_plc = o.orientation.toLowerCase();
|
_plc = o.orientation.toLowerCase();
|
||||||
plc = $.grep(plc, function(word){
|
plc = $.grep(plc, function(word){
|
||||||
return (/^auto|left|right|top|bottom$/).test(word);
|
return /^auto|left|right|top|bottom$/.test(word);
|
||||||
});
|
});
|
||||||
o.orientation = {x: 'auto', y: 'auto'};
|
o.orientation = {x: 'auto', y: 'auto'};
|
||||||
if (!_plc || _plc === 'auto')
|
if (!_plc || _plc === 'auto')
|
||||||
@ -27407,15 +27405,24 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_plc = $.grep(plc, function(word){
|
_plc = $.grep(plc, function(word){
|
||||||
return (/^left|right$/).test(word);
|
return /^left|right$/.test(word);
|
||||||
});
|
});
|
||||||
o.orientation.x = _plc[0] || 'auto';
|
o.orientation.x = _plc[0] || 'auto';
|
||||||
|
|
||||||
_plc = $.grep(plc, function(word){
|
_plc = $.grep(plc, function(word){
|
||||||
return (/^top|bottom$/).test(word);
|
return /^top|bottom$/.test(word);
|
||||||
});
|
});
|
||||||
o.orientation.y = _plc[0] || 'auto';
|
o.orientation.y = _plc[0] || 'auto';
|
||||||
}
|
}
|
||||||
|
if (o.defaultViewDate) {
|
||||||
|
var year = o.defaultViewDate.year || new Date().getFullYear();
|
||||||
|
var month = o.defaultViewDate.month || 0;
|
||||||
|
var day = o.defaultViewDate.day || 1;
|
||||||
|
o.defaultViewDate = UTCDate(year, month, day);
|
||||||
|
} else {
|
||||||
|
o.defaultViewDate = UTCToday();
|
||||||
|
}
|
||||||
|
o.showOnFocus = o.showOnFocus !== undefined ? o.showOnFocus : true;
|
||||||
},
|
},
|
||||||
_events: [],
|
_events: [],
|
||||||
_secondaryEvents: [],
|
_secondaryEvents: [],
|
||||||
@ -27448,34 +27455,32 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
_buildEvents: function(){
|
_buildEvents: function(){
|
||||||
if (this.isInput){ // single input
|
var events = {
|
||||||
this._events = [
|
keyup: $.proxy(function(e){
|
||||||
[this.element, {
|
if ($.inArray(e.keyCode, [27, 37, 39, 38, 40, 32, 13, 9]) === -1)
|
||||||
focus: $.proxy(this.show, this),
|
this.update();
|
||||||
keyup: $.proxy(function(e){
|
}, this),
|
||||||
if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1)
|
keydown: $.proxy(this.keydown, this)
|
||||||
this.update();
|
};
|
||||||
}, this),
|
|
||||||
keydown: $.proxy(this.keydown, this)
|
if (this.o.showOnFocus === true) {
|
||||||
}]
|
events.focus = $.proxy(this.show, this);
|
||||||
];
|
}
|
||||||
}
|
|
||||||
else if (this.component && this.hasInput){ // component: input + button
|
if (this.isInput) { // single input
|
||||||
this._events = [
|
this._events = [
|
||||||
// For components that are not readonly, allow keyboard nav
|
[this.element, events]
|
||||||
[this.element.find('input'), {
|
];
|
||||||
focus: $.proxy(this.show, this),
|
}
|
||||||
keyup: $.proxy(function(e){
|
else if (this.component && this.hasInput) { // component: input + button
|
||||||
if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1)
|
this._events = [
|
||||||
this.update();
|
// For components that are not readonly, allow keyboard nav
|
||||||
}, this),
|
[this.element.find('input'), events],
|
||||||
keydown: $.proxy(this.keydown, this)
|
[this.component, {
|
||||||
}],
|
click: $.proxy(this.show, this)
|
||||||
[this.component, {
|
}]
|
||||||
click: $.proxy(this.show, this)
|
];
|
||||||
}]
|
}
|
||||||
];
|
|
||||||
}
|
|
||||||
else if (this.element.is('div')){ // inline datepicker
|
else if (this.element.is('div')){ // inline datepicker
|
||||||
this.isInline = true;
|
this.isInline = true;
|
||||||
}
|
}
|
||||||
@ -27562,19 +27567,25 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
},
|
},
|
||||||
|
|
||||||
show: function(){
|
show: function(){
|
||||||
|
if (this.element.attr('readonly') && this.o.enableOnReadonly === false)
|
||||||
|
return;
|
||||||
if (!this.isInline)
|
if (!this.isInline)
|
||||||
this.picker.appendTo('body');
|
this.picker.appendTo(this.o.container);
|
||||||
this.picker.show();
|
|
||||||
this.place();
|
this.place();
|
||||||
|
this.picker.show();
|
||||||
this._attachSecondaryEvents();
|
this._attachSecondaryEvents();
|
||||||
this._trigger('show');
|
this._trigger('show');
|
||||||
|
if ((window.navigator.msMaxTouchPoints || 'ontouchstart' in document) && this.o.disableTouchKeyboard) {
|
||||||
|
$(this.element).blur();
|
||||||
|
}
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function(){
|
hide: function(){
|
||||||
if (this.isInline)
|
if (this.isInline)
|
||||||
return;
|
return this;
|
||||||
if (!this.picker.is(':visible'))
|
if (!this.picker.is(':visible'))
|
||||||
return;
|
return this;
|
||||||
this.focusDate = null;
|
this.focusDate = null;
|
||||||
this.picker.hide().detach();
|
this.picker.hide().detach();
|
||||||
this._detachSecondaryEvents();
|
this._detachSecondaryEvents();
|
||||||
@ -27590,6 +27601,7 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
)
|
)
|
||||||
this.setValue();
|
this.setValue();
|
||||||
this._trigger('hide');
|
this._trigger('hide');
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function(){
|
remove: function(){
|
||||||
@ -27601,6 +27613,7 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
if (!this.isInput){
|
if (!this.isInput){
|
||||||
delete this.element.data().date;
|
delete this.element.data().date;
|
||||||
}
|
}
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
_utc_to_local: function(utc){
|
_utc_to_local: function(utc){
|
||||||
@ -27631,14 +27644,39 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
},
|
},
|
||||||
|
|
||||||
getUTCDate: function(){
|
getUTCDate: function(){
|
||||||
return new Date(this.dates.get(-1));
|
var selected_date = this.dates.get(-1);
|
||||||
|
if (typeof selected_date !== 'undefined') {
|
||||||
|
return new Date(selected_date);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
clearDates: function(){
|
||||||
|
var element;
|
||||||
|
if (this.isInput) {
|
||||||
|
element = this.element;
|
||||||
|
} else if (this.component) {
|
||||||
|
element = this.element.find('input');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element) {
|
||||||
|
element.val('').change();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.update();
|
||||||
|
this._trigger('changeDate');
|
||||||
|
|
||||||
|
if (this.o.autoclose) {
|
||||||
|
this.hide();
|
||||||
|
}
|
||||||
|
},
|
||||||
setDates: function(){
|
setDates: function(){
|
||||||
var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
|
var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
|
||||||
this.update.apply(this, args);
|
this.update.apply(this, args);
|
||||||
this._trigger('changeDate');
|
this._trigger('changeDate');
|
||||||
this.setValue();
|
this.setValue();
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
setUTCDates: function(){
|
setUTCDates: function(){
|
||||||
@ -27646,6 +27684,7 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
this.update.apply(this, $.map(args, this._utc_to_local));
|
this.update.apply(this, $.map(args, this._utc_to_local));
|
||||||
this._trigger('changeDate');
|
this._trigger('changeDate');
|
||||||
this.setValue();
|
this.setValue();
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
setDate: alias('setDates'),
|
setDate: alias('setDates'),
|
||||||
@ -27661,6 +27700,7 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
else {
|
else {
|
||||||
this.element.val(formatted).change();
|
this.element.val(formatted).change();
|
||||||
}
|
}
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
getFormattedDate: function(format){
|
getFormattedDate: function(format){
|
||||||
@ -27677,41 +27717,51 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
this._process_options({startDate: startDate});
|
this._process_options({startDate: startDate});
|
||||||
this.update();
|
this.update();
|
||||||
this.updateNavArrows();
|
this.updateNavArrows();
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
setEndDate: function(endDate){
|
setEndDate: function(endDate){
|
||||||
this._process_options({endDate: endDate});
|
this._process_options({endDate: endDate});
|
||||||
this.update();
|
this.update();
|
||||||
this.updateNavArrows();
|
this.updateNavArrows();
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
setDaysOfWeekDisabled: function(daysOfWeekDisabled){
|
setDaysOfWeekDisabled: function(daysOfWeekDisabled){
|
||||||
this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});
|
this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});
|
||||||
this.update();
|
this.update();
|
||||||
this.updateNavArrows();
|
this.updateNavArrows();
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
setDatesDisabled: function(datesDisabled){
|
||||||
|
this._process_options({datesDisabled: datesDisabled});
|
||||||
|
this.update();
|
||||||
|
this.updateNavArrows();
|
||||||
},
|
},
|
||||||
|
|
||||||
place: function(){
|
place: function(){
|
||||||
if (this.isInline)
|
if (this.isInline)
|
||||||
return;
|
return this;
|
||||||
var calendarWidth = this.picker.outerWidth(),
|
var calendarWidth = this.picker.outerWidth(),
|
||||||
calendarHeight = this.picker.outerHeight(),
|
calendarHeight = this.picker.outerHeight(),
|
||||||
visualPadding = 10,
|
visualPadding = 10,
|
||||||
windowWidth = $window.width(),
|
windowWidth = $(this.o.container).width(),
|
||||||
windowHeight = $window.height(),
|
windowHeight = $(this.o.container).height(),
|
||||||
scrollTop = $window.scrollTop();
|
scrollTop = $(this.o.container).scrollTop(),
|
||||||
|
appendOffset = $(this.o.container).offset();
|
||||||
|
|
||||||
var parentsZindex = [];
|
var parentsZindex = [];
|
||||||
this.element.parents().each(function() {
|
this.element.parents().each(function(){
|
||||||
var itemZIndex = $(this).css('z-index');
|
var itemZIndex = $(this).css('z-index');
|
||||||
if ( itemZIndex !== 'auto' && itemZIndex !== 0 ) parentsZindex.push( parseInt( itemZIndex ) );
|
if (itemZIndex !== 'auto' && itemZIndex !== 0) parentsZindex.push(parseInt(itemZIndex));
|
||||||
});
|
});
|
||||||
var zIndex = Math.max.apply( Math, parentsZindex ) + 10;
|
var zIndex = Math.max.apply(Math, parentsZindex) + 10;
|
||||||
var offset = this.component ? this.component.parent().offset() : this.element.offset();
|
var offset = this.component ? this.component.parent().offset() : this.element.offset();
|
||||||
var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);
|
var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);
|
||||||
var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);
|
var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);
|
||||||
var left = offset.left,
|
var left = offset.left - appendOffset.left,
|
||||||
top = offset.top;
|
top = offset.top - appendOffset.top;
|
||||||
|
|
||||||
this.picker.removeClass(
|
this.picker.removeClass(
|
||||||
'datepicker-orient-top datepicker-orient-bottom '+
|
'datepicker-orient-top datepicker-orient-bottom '+
|
||||||
@ -27726,12 +27776,18 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
// auto x orientation is best-placement: if it crosses a window
|
// auto x orientation is best-placement: if it crosses a window
|
||||||
// edge, fudge it sideways
|
// edge, fudge it sideways
|
||||||
else {
|
else {
|
||||||
// Default to left
|
if (offset.left < 0) {
|
||||||
this.picker.addClass('datepicker-orient-left');
|
// component is outside the window on the left side. Move it into visible range
|
||||||
if (offset.left < 0)
|
this.picker.addClass('datepicker-orient-left');
|
||||||
left -= offset.left - visualPadding;
|
left -= offset.left - visualPadding;
|
||||||
else if (offset.left + calendarWidth > windowWidth)
|
} else if (left + calendarWidth > windowWidth) {
|
||||||
left = windowWidth - calendarWidth - visualPadding;
|
// the calendar passes the widow right edge. Align it to component right side
|
||||||
|
this.picker.addClass('datepicker-orient-right');
|
||||||
|
left = offset.left + width - calendarWidth;
|
||||||
|
} else {
|
||||||
|
// Default to left
|
||||||
|
this.picker.addClass('datepicker-orient-left');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// auto y orientation is best-situation: top or bottom, no fudging,
|
// auto y orientation is best-situation: top or bottom, no fudging,
|
||||||
@ -27739,8 +27795,8 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
var yorient = this.o.orientation.y,
|
var yorient = this.o.orientation.y,
|
||||||
top_overflow, bottom_overflow;
|
top_overflow, bottom_overflow;
|
||||||
if (yorient === 'auto'){
|
if (yorient === 'auto'){
|
||||||
top_overflow = -scrollTop + offset.top - calendarHeight;
|
top_overflow = -scrollTop + top - calendarHeight;
|
||||||
bottom_overflow = scrollTop + windowHeight - (offset.top + height + calendarHeight);
|
bottom_overflow = scrollTop + windowHeight - (top + height + calendarHeight);
|
||||||
if (Math.max(top_overflow, bottom_overflow) === bottom_overflow)
|
if (Math.max(top_overflow, bottom_overflow) === bottom_overflow)
|
||||||
yorient = 'top';
|
yorient = 'top';
|
||||||
else
|
else
|
||||||
@ -27752,17 +27808,27 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
else
|
else
|
||||||
top -= calendarHeight + parseInt(this.picker.css('padding-top'));
|
top -= calendarHeight + parseInt(this.picker.css('padding-top'));
|
||||||
|
|
||||||
this.picker.css({
|
if (this.o.rtl) {
|
||||||
top: top,
|
var right = windowWidth - (left + width);
|
||||||
left: left,
|
this.picker.css({
|
||||||
zIndex: zIndex
|
top: top,
|
||||||
});
|
right: right,
|
||||||
|
zIndex: zIndex
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.picker.css({
|
||||||
|
top: top,
|
||||||
|
left: left,
|
||||||
|
zIndex: zIndex
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
_allow_update: true,
|
_allow_update: true,
|
||||||
update: function(){
|
update: function(){
|
||||||
if (!this._allow_update)
|
if (!this._allow_update)
|
||||||
return;
|
return this;
|
||||||
|
|
||||||
var oldDates = this.dates.copy(),
|
var oldDates = this.dates.copy(),
|
||||||
dates = [],
|
dates = [],
|
||||||
@ -27818,15 +27884,19 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
this._trigger('clearDate');
|
this._trigger('clearDate');
|
||||||
|
|
||||||
this.fill();
|
this.fill();
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
fillDow: function(){
|
fillDow: function(){
|
||||||
var dowCnt = this.o.weekStart,
|
var dowCnt = this.o.weekStart,
|
||||||
html = '<tr>';
|
html = '<tr>';
|
||||||
if (this.o.calendarWeeks){
|
if (this.o.calendarWeeks){
|
||||||
var cell = '<th class="cw"> </th>';
|
this.picker.find('.datepicker-days thead tr:first-child .datepicker-switch')
|
||||||
|
.attr('colspan', function(i, val){
|
||||||
|
return parseInt(val) + 1;
|
||||||
|
});
|
||||||
|
var cell = '<th class="cw"> </th>';
|
||||||
html += cell;
|
html += cell;
|
||||||
this.picker.find('.datepicker-days thead tr:first-child').prepend(cell);
|
|
||||||
}
|
}
|
||||||
while (dowCnt < this.o.weekStart + 7){
|
while (dowCnt < this.o.weekStart + 7){
|
||||||
html += '<th class="dow">'+dates[this.o.language].daysMin[(dowCnt++)%7]+'</th>';
|
html += '<th class="dow">'+dates[this.o.language].daysMin[(dowCnt++)%7]+'</th>';
|
||||||
@ -27880,6 +27950,12 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
$.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1){
|
$.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1){
|
||||||
cls.push('disabled');
|
cls.push('disabled');
|
||||||
}
|
}
|
||||||
|
if (this.o.datesDisabled.length > 0 &&
|
||||||
|
$.grep(this.o.datesDisabled, function(d){
|
||||||
|
return isUTCEquals(date, d); }).length > 0) {
|
||||||
|
cls.push('disabled', 'disabled-date');
|
||||||
|
}
|
||||||
|
|
||||||
if (this.range){
|
if (this.range){
|
||||||
if (date > this.range[0] && date < this.range[this.range.length-1]){
|
if (date > this.range[0] && date < this.range[this.range.length-1]){
|
||||||
cls.push('range');
|
cls.push('range');
|
||||||
@ -27902,13 +27978,14 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
todaytxt = dates[this.o.language].today || dates['en'].today || '',
|
todaytxt = dates[this.o.language].today || dates['en'].today || '',
|
||||||
cleartxt = dates[this.o.language].clear || dates['en'].clear || '',
|
cleartxt = dates[this.o.language].clear || dates['en'].clear || '',
|
||||||
tooltip;
|
tooltip;
|
||||||
if (isNaN(year) || isNaN(month)) return;
|
if (isNaN(year) || isNaN(month))
|
||||||
this.picker.find('.datepicker-days thead th.datepicker-switch')
|
return;
|
||||||
|
this.picker.find('.datepicker-days thead .datepicker-switch')
|
||||||
.text(dates[this.o.language].months[month]+' '+year);
|
.text(dates[this.o.language].months[month]+' '+year);
|
||||||
this.picker.find('tfoot th.today')
|
this.picker.find('tfoot .today')
|
||||||
.text(todaytxt)
|
.text(todaytxt)
|
||||||
.toggle(this.o.todayBtn !== false);
|
.toggle(this.o.todayBtn !== false);
|
||||||
this.picker.find('tfoot th.clear')
|
this.picker.find('tfoot .clear')
|
||||||
.text(cleartxt)
|
.text(cleartxt)
|
||||||
.toggle(this.o.clearBtn !== false);
|
.toggle(this.o.clearBtn !== false);
|
||||||
this.updateNavArrows();
|
this.updateNavArrows();
|
||||||
@ -27991,6 +28068,18 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
months.slice(endMonth+1).addClass('disabled');
|
months.slice(endMonth+1).addClass('disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.o.beforeShowMonth !== $.noop){
|
||||||
|
var that = this;
|
||||||
|
$.each(months, function(i, month){
|
||||||
|
if (!$(month).hasClass('disabled')) {
|
||||||
|
var moDate = new Date(year, i, 1);
|
||||||
|
var before = that.o.beforeShowMonth(moDate);
|
||||||
|
if (before === false)
|
||||||
|
$(month).addClass('disabled');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
html = '';
|
html = '';
|
||||||
year = parseInt(year/10, 10) * 10;
|
year = parseInt(year/10, 10) * 10;
|
||||||
var yearCont = this.picker.find('.datepicker-years')
|
var yearCont = this.picker.find('.datepicker-years')
|
||||||
@ -28013,7 +28102,7 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
classes.push('active');
|
classes.push('active');
|
||||||
if (year < startYear || year > endYear)
|
if (year < startYear || year > endYear)
|
||||||
classes.push('disabled');
|
classes.push('disabled');
|
||||||
html += '<span class="' + classes.join(' ') + '">'+year+'</span>';
|
html += '<span class="' + classes.join(' ') + '">' + year + '</span>';
|
||||||
year += 1;
|
year += 1;
|
||||||
}
|
}
|
||||||
yearCont.html(html);
|
yearCont.html(html);
|
||||||
@ -28096,24 +28185,14 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
this._setDate(date, which);
|
this._setDate(date, which);
|
||||||
break;
|
break;
|
||||||
case 'clear':
|
case 'clear':
|
||||||
var element;
|
this.clearDates();
|
||||||
if (this.isInput)
|
|
||||||
element = this.element;
|
|
||||||
else if (this.component)
|
|
||||||
element = this.element.find('input');
|
|
||||||
if (element)
|
|
||||||
element.val("").change();
|
|
||||||
this.update();
|
|
||||||
this._trigger('changeDate');
|
|
||||||
if (this.o.autoclose)
|
|
||||||
this.hide();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'span':
|
case 'span':
|
||||||
if (!target.is('.disabled')){
|
if (!target.hasClass('disabled')){
|
||||||
this.viewDate.setUTCDate(1);
|
this.viewDate.setUTCDate(1);
|
||||||
if (target.is('.month')){
|
if (target.hasClass('month')){
|
||||||
day = 1;
|
day = 1;
|
||||||
month = target.parent().find('span').index(target);
|
month = target.parent().find('span').index(target);
|
||||||
year = this.viewDate.getUTCFullYear();
|
year = this.viewDate.getUTCFullYear();
|
||||||
@ -28138,11 +28217,11 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'td':
|
case 'td':
|
||||||
if (target.is('.day') && !target.is('.disabled')){
|
if (target.hasClass('day') && !target.hasClass('disabled')){
|
||||||
day = parseInt(target.text(), 10)||1;
|
day = parseInt(target.text(), 10)||1;
|
||||||
year = this.viewDate.getUTCFullYear();
|
year = this.viewDate.getUTCFullYear();
|
||||||
month = this.viewDate.getUTCMonth();
|
month = this.viewDate.getUTCMonth();
|
||||||
if (target.is('.old')){
|
if (target.hasClass('old')){
|
||||||
if (month === 0){
|
if (month === 0){
|
||||||
month = 11;
|
month = 11;
|
||||||
year -= 1;
|
year -= 1;
|
||||||
@ -28151,7 +28230,7 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
month -= 1;
|
month -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (target.is('.new')){
|
else if (target.hasClass('new')){
|
||||||
if (month === 11){
|
if (month === 11){
|
||||||
month = 0;
|
month = 0;
|
||||||
year += 1;
|
year += 1;
|
||||||
@ -28176,15 +28255,19 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
if (!date){
|
if (!date){
|
||||||
this.dates.clear();
|
this.dates.clear();
|
||||||
}
|
}
|
||||||
if (this.o.multidate === 1 && ix === 0){
|
|
||||||
// single datepicker, don't remove selected date
|
if (ix !== -1){
|
||||||
}
|
if (this.o.multidate === true || this.o.multidate > 1 || this.o.toggleActive){
|
||||||
else if (ix !== -1){
|
this.dates.remove(ix);
|
||||||
this.dates.remove(ix);
|
}
|
||||||
|
} else if (this.o.multidate === false) {
|
||||||
|
this.dates.clear();
|
||||||
|
this.dates.push(date);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.dates.push(date);
|
this.dates.push(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof this.o.multidate === 'number')
|
if (typeof this.o.multidate === 'number')
|
||||||
while (this.dates.length > this.o.multidate)
|
while (this.dates.length > this.o.multidate)
|
||||||
this.dates.remove(0);
|
this.dates.remove(0);
|
||||||
@ -28198,7 +28281,9 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
|
|
||||||
this.fill();
|
this.fill();
|
||||||
this.setValue();
|
this.setValue();
|
||||||
this._trigger('changeDate');
|
if (!which || which !== 'view') {
|
||||||
|
this._trigger('changeDate');
|
||||||
|
}
|
||||||
var element;
|
var element;
|
||||||
if (this.isInput){
|
if (this.isInput){
|
||||||
element = this.element;
|
element = this.element;
|
||||||
@ -28273,7 +28358,7 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
},
|
},
|
||||||
|
|
||||||
keydown: function(e){
|
keydown: function(e){
|
||||||
if (this.picker.is(':not(:visible)')){
|
if (!this.picker.is(':visible')){
|
||||||
if (e.keyCode === 27) // allow escape to hide and re-show picker
|
if (e.keyCode === 27) // allow escape to hide and re-show picker
|
||||||
this.show();
|
this.show();
|
||||||
return;
|
return;
|
||||||
@ -28313,7 +28398,7 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
newViewDate = new Date(focusDate);
|
newViewDate = new Date(focusDate);
|
||||||
newViewDate.setUTCDate(focusDate.getUTCDate() + dir);
|
newViewDate.setUTCDate(focusDate.getUTCDate() + dir);
|
||||||
}
|
}
|
||||||
if (this.dateWithinRange(newDate)){
|
if (this.dateWithinRange(newViewDate)){
|
||||||
this.focusDate = this.viewDate = newViewDate;
|
this.focusDate = this.viewDate = newViewDate;
|
||||||
this.setValue();
|
this.setValue();
|
||||||
this.fill();
|
this.fill();
|
||||||
@ -28341,7 +28426,7 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
newViewDate = new Date(focusDate);
|
newViewDate = new Date(focusDate);
|
||||||
newViewDate.setUTCDate(focusDate.getUTCDate() + dir * 7);
|
newViewDate.setUTCDate(focusDate.getUTCDate() + dir * 7);
|
||||||
}
|
}
|
||||||
if (this.dateWithinRange(newDate)){
|
if (this.dateWithinRange(newViewDate)){
|
||||||
this.focusDate = this.viewDate = newViewDate;
|
this.focusDate = this.viewDate = newViewDate;
|
||||||
this.setValue();
|
this.setValue();
|
||||||
this.fill();
|
this.fill();
|
||||||
@ -28364,6 +28449,11 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
this.fill();
|
this.fill();
|
||||||
if (this.picker.is(':visible')){
|
if (this.picker.is(':visible')){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
if (typeof e.stopPropagation === 'function') {
|
||||||
|
e.stopPropagation(); // All modern browsers, IE9+
|
||||||
|
} else {
|
||||||
|
e.cancelBubble = true; // IE6,7,8 ignore "stopPropagation"
|
||||||
|
}
|
||||||
if (this.o.autoclose)
|
if (this.o.autoclose)
|
||||||
this.hide();
|
this.hide();
|
||||||
}
|
}
|
||||||
@ -28398,9 +28488,9 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir));
|
this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir));
|
||||||
}
|
}
|
||||||
this.picker
|
this.picker
|
||||||
.find('>div')
|
.children('div')
|
||||||
.hide()
|
.hide()
|
||||||
.filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName)
|
.filter('.datepicker-' + DPGlobal.modes[this.viewMode].clsName)
|
||||||
.css('display', 'block');
|
.css('display', 'block');
|
||||||
this.updateNavArrows();
|
this.updateNavArrows();
|
||||||
}
|
}
|
||||||
@ -28413,8 +28503,7 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
});
|
});
|
||||||
delete options.inputs;
|
delete options.inputs;
|
||||||
|
|
||||||
$(this.inputs)
|
datepickerPlugin.call($(this.inputs), options)
|
||||||
.datepicker(options)
|
|
||||||
.bind('changeDate', $.proxy(this.dateUpdated, this));
|
.bind('changeDate', $.proxy(this.dateUpdated, this));
|
||||||
|
|
||||||
this.pickers = $.map(this.inputs, function(i){
|
this.pickers = $.map(this.inputs, function(i){
|
||||||
@ -28448,6 +28537,8 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
var dp = $(e.target).data('datepicker'),
|
var dp = $(e.target).data('datepicker'),
|
||||||
new_date = dp.getUTCDate(),
|
new_date = dp.getUTCDate(),
|
||||||
i = $.inArray(e.target, this.inputs),
|
i = $.inArray(e.target, this.inputs),
|
||||||
|
j = i - 1,
|
||||||
|
k = i + 1,
|
||||||
l = this.inputs.length;
|
l = this.inputs.length;
|
||||||
if (i === -1)
|
if (i === -1)
|
||||||
return;
|
return;
|
||||||
@ -28457,16 +28548,16 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
p.setUTCDate(new_date);
|
p.setUTCDate(new_date);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (new_date < this.dates[i]){
|
if (new_date < this.dates[j]){
|
||||||
// Date being moved earlier/left
|
// Date being moved earlier/left
|
||||||
while (i >= 0 && new_date < this.dates[i]){
|
while (j >= 0 && new_date < this.dates[j]){
|
||||||
this.pickers[i--].setUTCDate(new_date);
|
this.pickers[j--].setUTCDate(new_date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (new_date > this.dates[i]){
|
else if (new_date > this.dates[k]){
|
||||||
// Date being moved later/right
|
// Date being moved later/right
|
||||||
while (i < l && new_date > this.dates[i]){
|
while (k < l && new_date > this.dates[k]){
|
||||||
this.pickers[i++].setUTCDate(new_date);
|
this.pickers[k++].setUTCDate(new_date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.updateDates();
|
this.updateDates();
|
||||||
@ -28515,7 +28606,7 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
}
|
}
|
||||||
|
|
||||||
var old = $.fn.datepicker;
|
var old = $.fn.datepicker;
|
||||||
$.fn.datepicker = function(option){
|
var datepickerPlugin = function(option){
|
||||||
var args = Array.apply(null, arguments);
|
var args = Array.apply(null, arguments);
|
||||||
args.shift();
|
args.shift();
|
||||||
var internal_return;
|
var internal_return;
|
||||||
@ -28530,7 +28621,7 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
locopts = opts_from_locale(xopts.language),
|
locopts = opts_from_locale(xopts.language),
|
||||||
// Options priority: js args, data-attrs, locales, defaults
|
// Options priority: js args, data-attrs, locales, defaults
|
||||||
opts = $.extend({}, defaults, locopts, elopts, options);
|
opts = $.extend({}, defaults, locopts, elopts, options);
|
||||||
if ($this.is('.input-daterange') || opts.inputs){
|
if ($this.hasClass('input-daterange') || opts.inputs){
|
||||||
var ropts = {
|
var ropts = {
|
||||||
inputs: opts.inputs || $this.find('input').toArray()
|
inputs: opts.inputs || $this.find('input').toArray()
|
||||||
};
|
};
|
||||||
@ -28551,13 +28642,17 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
else
|
else
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
$.fn.datepicker = datepickerPlugin;
|
||||||
|
|
||||||
var defaults = $.fn.datepicker.defaults = {
|
var defaults = $.fn.datepicker.defaults = {
|
||||||
autoclose: false,
|
autoclose: false,
|
||||||
beforeShowDay: $.noop,
|
beforeShowDay: $.noop,
|
||||||
|
beforeShowMonth: $.noop,
|
||||||
calendarWeeks: false,
|
calendarWeeks: false,
|
||||||
clearBtn: false,
|
clearBtn: false,
|
||||||
|
toggleActive: false,
|
||||||
daysOfWeekDisabled: [],
|
daysOfWeekDisabled: [],
|
||||||
|
datesDisabled: [],
|
||||||
endDate: Infinity,
|
endDate: Infinity,
|
||||||
forceParse: true,
|
forceParse: true,
|
||||||
format: 'mm/dd/yyyy',
|
format: 'mm/dd/yyyy',
|
||||||
@ -28572,7 +28667,10 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
startView: 0,
|
startView: 0,
|
||||||
todayBtn: false,
|
todayBtn: false,
|
||||||
todayHighlight: false,
|
todayHighlight: false,
|
||||||
weekStart: 0
|
weekStart: 0,
|
||||||
|
disableTouchKeyboard: false,
|
||||||
|
enableOnReadonly: true,
|
||||||
|
container: 'body'
|
||||||
};
|
};
|
||||||
var locale_opts = $.fn.datepicker.locale_opts = [
|
var locale_opts = $.fn.datepicker.locale_opts = [
|
||||||
'format',
|
'format',
|
||||||
@ -28700,7 +28798,7 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
function match_part(){
|
function match_part(){
|
||||||
var m = this.slice(0, parts[i].length),
|
var m = this.slice(0, parts[i].length),
|
||||||
p = parts[i].slice(0, m.length);
|
p = parts[i].slice(0, m.length);
|
||||||
return m === p;
|
return m.toLowerCase() === p.toLowerCase();
|
||||||
}
|
}
|
||||||
if (parts.length === fparts.length){
|
if (parts.length === fparts.length){
|
||||||
var cnt;
|
var cnt;
|
||||||
@ -28762,9 +28860,9 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
},
|
},
|
||||||
headTemplate: '<thead>'+
|
headTemplate: '<thead>'+
|
||||||
'<tr>'+
|
'<tr>'+
|
||||||
'<th class="prev">«</th>'+
|
'<th class="prev">«</th>'+
|
||||||
'<th colspan="5" class="datepicker-switch"></th>'+
|
'<th colspan="5" class="datepicker-switch"></th>'+
|
||||||
'<th class="next">»</th>'+
|
'<th class="next">»</th>'+
|
||||||
'</tr>'+
|
'</tr>'+
|
||||||
'</thead>',
|
'</thead>',
|
||||||
contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
|
contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
|
||||||
@ -28812,6 +28910,9 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* DATEPICKER VERSION
|
||||||
|
* =================== */
|
||||||
|
$.fn.datepicker.version = "1.4.0";
|
||||||
|
|
||||||
/* DATEPICKER DATA-API
|
/* DATEPICKER DATA-API
|
||||||
* ================== */
|
* ================== */
|
||||||
@ -28825,11 +28926,11 @@ d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.p
|
|||||||
return;
|
return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
// component click requires us to explicitly show it
|
// component click requires us to explicitly show it
|
||||||
$this.datepicker('show');
|
datepickerPlugin.call($this, 'show');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$(function(){
|
$(function(){
|
||||||
$('[data-provide="datepicker-inline"]').datepicker();
|
datepickerPlugin.call($('[data-provide="datepicker-inline"]'));
|
||||||
});
|
});
|
||||||
|
|
||||||
}(window.jQuery));
|
}(window.jQuery));
|
||||||
|
32
public/js/pdfmake.min.js
vendored
32
public/js/pdfmake.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user