Merge branch 'master' of https://github.com/thelia/thelia
Conflicts: core/lib/Thelia/Config/Resources/routing/admin.xml
This commit is contained in:
@@ -146,7 +146,7 @@
|
||||
|
||||
{loop name="menu-auth-coupon" type="auth" roles="ADMIN" permissions="admin.coupon.view"}
|
||||
<li class="{if $admin_current_location == 'coupon'}active{/if}" id="coupon_menu">
|
||||
<a href="{url path='/admin/coupon-list'}">{intl l="Coupons"}</a>
|
||||
<a href="{url path='/admin/coupon/'}">{intl l="Coupons"}</a>
|
||||
</li>
|
||||
{/loop}
|
||||
|
||||
|
||||
@@ -1,474 +1,474 @@
|
||||
/* =========================================================
|
||||
* bootstrap-datepicker.js
|
||||
* http://www.eyecon.ro/bootstrap-datepicker
|
||||
* =========================================================
|
||||
* Copyright 2012 Stefan Petre
|
||||
*
|
||||
* 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( $ ) {
|
||||
|
||||
// Picker object
|
||||
|
||||
var Datepicker = function(element, options){
|
||||
this.element = $(element);
|
||||
this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy');
|
||||
this.picker = $(DPGlobal.template)
|
||||
.appendTo('body')
|
||||
.on({
|
||||
click: $.proxy(this.click, this)//,
|
||||
//mousedown: $.proxy(this.mousedown, this)
|
||||
});
|
||||
this.isInput = this.element.is('input');
|
||||
this.component = this.element.is('.date') ? this.element.find('.add-on') : false;
|
||||
|
||||
if (this.isInput) {
|
||||
this.element.on({
|
||||
focus: $.proxy(this.show, this),
|
||||
//blur: $.proxy(this.hide, this),
|
||||
keyup: $.proxy(this.update, this)
|
||||
});
|
||||
} else {
|
||||
if (this.component){
|
||||
this.component.on('click', $.proxy(this.show, this));
|
||||
} else {
|
||||
this.element.on('click', $.proxy(this.show, this));
|
||||
}
|
||||
}
|
||||
|
||||
this.minViewMode = options.minViewMode||this.element.data('date-minviewmode')||0;
|
||||
if (typeof this.minViewMode === 'string') {
|
||||
switch (this.minViewMode) {
|
||||
case 'months':
|
||||
this.minViewMode = 1;
|
||||
break;
|
||||
case 'years':
|
||||
this.minViewMode = 2;
|
||||
break;
|
||||
default:
|
||||
this.minViewMode = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.viewMode = options.viewMode||this.element.data('date-viewmode')||0;
|
||||
if (typeof this.viewMode === 'string') {
|
||||
switch (this.viewMode) {
|
||||
case 'months':
|
||||
this.viewMode = 1;
|
||||
break;
|
||||
case 'years':
|
||||
this.viewMode = 2;
|
||||
break;
|
||||
default:
|
||||
this.viewMode = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.startViewMode = this.viewMode;
|
||||
this.weekStart = options.weekStart||this.element.data('date-weekstart')||0;
|
||||
this.weekEnd = this.weekStart === 0 ? 6 : this.weekStart - 1;
|
||||
this.onRender = options.onRender;
|
||||
this.fillDow();
|
||||
this.fillMonths();
|
||||
this.update();
|
||||
this.showMode();
|
||||
};
|
||||
|
||||
Datepicker.prototype = {
|
||||
constructor: Datepicker,
|
||||
|
||||
show: function(e) {
|
||||
this.picker.show();
|
||||
this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();
|
||||
this.place();
|
||||
$(window).on('resize', $.proxy(this.place, this));
|
||||
if (e ) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
if (!this.isInput) {
|
||||
}
|
||||
var that = this;
|
||||
$(document).on('mousedown', function(ev){
|
||||
if ($(ev.target).closest('.datepicker').length == 0) {
|
||||
that.hide();
|
||||
}
|
||||
});
|
||||
this.element.trigger({
|
||||
type: 'show',
|
||||
date: this.date
|
||||
});
|
||||
},
|
||||
|
||||
hide: function(){
|
||||
this.picker.hide();
|
||||
$(window).off('resize', this.place);
|
||||
this.viewMode = this.startViewMode;
|
||||
this.showMode();
|
||||
if (!this.isInput) {
|
||||
$(document).off('mousedown', this.hide);
|
||||
}
|
||||
//this.set();
|
||||
this.element.trigger({
|
||||
type: 'hide',
|
||||
date: this.date
|
||||
});
|
||||
},
|
||||
|
||||
set: function() {
|
||||
var formated = DPGlobal.formatDate(this.date, this.format);
|
||||
if (!this.isInput) {
|
||||
if (this.component){
|
||||
this.element.find('input').prop('value', formated);
|
||||
}
|
||||
this.element.data('date', formated);
|
||||
} else {
|
||||
this.element.prop('value', formated);
|
||||
}
|
||||
},
|
||||
|
||||
setValue: function(newDate) {
|
||||
if (typeof newDate === 'string') {
|
||||
this.date = DPGlobal.parseDate(newDate, this.format);
|
||||
} else {
|
||||
this.date = new Date(newDate);
|
||||
}
|
||||
this.set();
|
||||
this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0);
|
||||
this.fill();
|
||||
},
|
||||
|
||||
place: function(){
|
||||
var offset = this.component ? this.component.offset() : this.element.offset();
|
||||
this.picker.css({
|
||||
top: offset.top + this.height,
|
||||
left: offset.left
|
||||
});
|
||||
},
|
||||
|
||||
update: function(newDate){
|
||||
this.date = DPGlobal.parseDate(
|
||||
typeof newDate === 'string' ? newDate : (this.isInput ? this.element.prop('value') : this.element.data('date')),
|
||||
this.format
|
||||
);
|
||||
this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0);
|
||||
this.fill();
|
||||
},
|
||||
|
||||
fillDow: function(){
|
||||
var dowCnt = this.weekStart;
|
||||
var html = '<tr>';
|
||||
while (dowCnt < this.weekStart + 7) {
|
||||
html += '<th class="dow">'+DPGlobal.dates.daysMin[(dowCnt++)%7]+'</th>';
|
||||
}
|
||||
html += '</tr>';
|
||||
this.picker.find('.datepicker-days thead').append(html);
|
||||
},
|
||||
|
||||
fillMonths: function(){
|
||||
var html = '';
|
||||
var i = 0
|
||||
while (i < 12) {
|
||||
html += '<span class="month">'+DPGlobal.dates.monthsShort[i++]+'</span>';
|
||||
}
|
||||
this.picker.find('.datepicker-months td').append(html);
|
||||
},
|
||||
|
||||
fill: function() {
|
||||
var d = new Date(this.viewDate),
|
||||
year = d.getFullYear(),
|
||||
month = d.getMonth(),
|
||||
currentDate = this.date.valueOf();
|
||||
this.picker.find('.datepicker-days th:eq(1)')
|
||||
.text(DPGlobal.dates.months[month]+' '+year);
|
||||
var prevMonth = new Date(year, month-1, 28,0,0,0,0),
|
||||
day = DPGlobal.getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth());
|
||||
prevMonth.setDate(day);
|
||||
prevMonth.setDate(day - (prevMonth.getDay() - this.weekStart + 7)%7);
|
||||
var nextMonth = new Date(prevMonth);
|
||||
nextMonth.setDate(nextMonth.getDate() + 42);
|
||||
nextMonth = nextMonth.valueOf();
|
||||
var html = [];
|
||||
var clsName,
|
||||
prevY,
|
||||
prevM;
|
||||
while(prevMonth.valueOf() < nextMonth) {
|
||||
if (prevMonth.getDay() === this.weekStart) {
|
||||
html.push('<tr>');
|
||||
}
|
||||
clsName = this.onRender(prevMonth);
|
||||
prevY = prevMonth.getFullYear();
|
||||
prevM = prevMonth.getMonth();
|
||||
if ((prevM < month && prevY === year) || prevY < year) {
|
||||
clsName += ' old';
|
||||
} else if ((prevM > month && prevY === year) || prevY > year) {
|
||||
clsName += ' new';
|
||||
}
|
||||
if (prevMonth.valueOf() === currentDate) {
|
||||
clsName += ' active';
|
||||
}
|
||||
html.push('<td class="day '+clsName+'">'+prevMonth.getDate() + '</td>');
|
||||
if (prevMonth.getDay() === this.weekEnd) {
|
||||
html.push('</tr>');
|
||||
}
|
||||
prevMonth.setDate(prevMonth.getDate()+1);
|
||||
}
|
||||
this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
|
||||
var currentYear = this.date.getFullYear();
|
||||
|
||||
var months = this.picker.find('.datepicker-months')
|
||||
.find('th:eq(1)')
|
||||
.text(year)
|
||||
.end()
|
||||
.find('span').removeClass('active');
|
||||
if (currentYear === year) {
|
||||
months.eq(this.date.getMonth()).addClass('active');
|
||||
}
|
||||
|
||||
html = '';
|
||||
year = parseInt(year/10, 10) * 10;
|
||||
var yearCont = this.picker.find('.datepicker-years')
|
||||
.find('th:eq(1)')
|
||||
.text(year + '-' + (year + 9))
|
||||
.end()
|
||||
.find('td');
|
||||
year -= 1;
|
||||
for (var i = -1; i < 11; i++) {
|
||||
html += '<span class="year'+(i === -1 || i === 10 ? ' old' : '')+(currentYear === year ? ' active' : '')+'">'+year+'</span>';
|
||||
year += 1;
|
||||
}
|
||||
yearCont.html(html);
|
||||
},
|
||||
|
||||
click: function(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
var target = $(e.target).closest('span, td, th');
|
||||
if (target.length === 1) {
|
||||
switch(target[0].nodeName.toLowerCase()) {
|
||||
case 'th':
|
||||
switch(target[0].className) {
|
||||
case 'switch':
|
||||
this.showMode(1);
|
||||
break;
|
||||
case 'prev':
|
||||
case 'next':
|
||||
this.viewDate['set'+DPGlobal.modes[this.viewMode].navFnc].call(
|
||||
this.viewDate,
|
||||
this.viewDate['get'+DPGlobal.modes[this.viewMode].navFnc].call(this.viewDate) +
|
||||
DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1)
|
||||
);
|
||||
this.fill();
|
||||
this.set();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'span':
|
||||
if (target.is('.month')) {
|
||||
var month = target.parent().find('span').index(target);
|
||||
this.viewDate.setMonth(month);
|
||||
} else {
|
||||
var year = parseInt(target.text(), 10)||0;
|
||||
this.viewDate.setFullYear(year);
|
||||
}
|
||||
if (this.viewMode !== 0) {
|
||||
this.date = new Date(this.viewDate);
|
||||
this.element.trigger({
|
||||
type: 'changeDate',
|
||||
date: this.date,
|
||||
viewMode: DPGlobal.modes[this.viewMode].clsName
|
||||
});
|
||||
}
|
||||
this.showMode(-1);
|
||||
this.fill();
|
||||
this.set();
|
||||
break;
|
||||
case 'td':
|
||||
if (target.is('.day') && !target.is('.disabled')){
|
||||
var day = parseInt(target.text(), 10)||1;
|
||||
var month = this.viewDate.getMonth();
|
||||
if (target.is('.old')) {
|
||||
month -= 1;
|
||||
} else if (target.is('.new')) {
|
||||
month += 1;
|
||||
}
|
||||
var year = this.viewDate.getFullYear();
|
||||
this.date = new Date(year, month, day,0,0,0,0);
|
||||
this.viewDate = new Date(year, month, Math.min(28, day),0,0,0,0);
|
||||
this.fill();
|
||||
this.set();
|
||||
this.element.trigger({
|
||||
type: 'changeDate',
|
||||
date: this.date,
|
||||
viewMode: DPGlobal.modes[this.viewMode].clsName
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
mousedown: function(e){
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
},
|
||||
|
||||
showMode: function(dir) {
|
||||
if (dir) {
|
||||
this.viewMode = Math.max(this.minViewMode, Math.min(2, this.viewMode + dir));
|
||||
}
|
||||
this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.datepicker = function ( option, val ) {
|
||||
return this.each(function () {
|
||||
var $this = $(this),
|
||||
data = $this.data('datepicker'),
|
||||
options = typeof option === 'object' && option;
|
||||
if (!data) {
|
||||
$this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options))));
|
||||
}
|
||||
if (typeof option === 'string') data[option](val);
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.datepicker.defaults = {
|
||||
onRender: function(date) {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
$.fn.datepicker.Constructor = Datepicker;
|
||||
|
||||
var DPGlobal = {
|
||||
modes: [
|
||||
{
|
||||
clsName: 'days',
|
||||
navFnc: 'Month',
|
||||
navStep: 1
|
||||
},
|
||||
{
|
||||
clsName: 'months',
|
||||
navFnc: 'FullYear',
|
||||
navStep: 1
|
||||
},
|
||||
{
|
||||
clsName: 'years',
|
||||
navFnc: 'FullYear',
|
||||
navStep: 10
|
||||
}],
|
||||
dates:{
|
||||
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"]
|
||||
},
|
||||
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]
|
||||
},
|
||||
parseFormat: function(format){
|
||||
var separator = format.match(/[.\/\-\s].*?/),
|
||||
parts = format.split(/\W+/);
|
||||
if (!separator || !parts || parts.length === 0){
|
||||
throw new Error("Invalid date format.");
|
||||
}
|
||||
return {separator: separator, parts: parts};
|
||||
},
|
||||
parseDate: function(date, format) {
|
||||
var parts = date.split(format.separator),
|
||||
date = new Date(),
|
||||
val;
|
||||
date.setHours(0);
|
||||
date.setMinutes(0);
|
||||
date.setSeconds(0);
|
||||
date.setMilliseconds(0);
|
||||
if (parts.length === format.parts.length) {
|
||||
var year = date.getFullYear(), day = date.getDate(), month = date.getMonth();
|
||||
for (var i=0, cnt = format.parts.length; i < cnt; i++) {
|
||||
val = parseInt(parts[i], 10)||1;
|
||||
switch(format.parts[i]) {
|
||||
case 'dd':
|
||||
case 'd':
|
||||
day = val;
|
||||
date.setDate(val);
|
||||
break;
|
||||
case 'mm':
|
||||
case 'm':
|
||||
month = val - 1;
|
||||
date.setMonth(val - 1);
|
||||
break;
|
||||
case 'yy':
|
||||
year = 2000 + val;
|
||||
date.setFullYear(2000 + val);
|
||||
break;
|
||||
case 'yyyy':
|
||||
year = val;
|
||||
date.setFullYear(val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
date = new Date(year, month, day, 0 ,0 ,0);
|
||||
}
|
||||
return date;
|
||||
},
|
||||
formatDate: function(date, format){
|
||||
var val = {
|
||||
d: date.getDate(),
|
||||
m: date.getMonth() + 1,
|
||||
yy: date.getFullYear().toString().substring(2),
|
||||
yyyy: date.getFullYear()
|
||||
};
|
||||
val.dd = (val.d < 10 ? '0' : '') + val.d;
|
||||
val.mm = (val.m < 10 ? '0' : '') + val.m;
|
||||
var date = [];
|
||||
for (var i=0, cnt = format.parts.length; i < cnt; i++) {
|
||||
date.push(val[format.parts[i]]);
|
||||
}
|
||||
return date.join(format.separator);
|
||||
},
|
||||
headTemplate: '<thead>'+
|
||||
'<tr>'+
|
||||
'<th class="prev">‹</th>'+
|
||||
'<th colspan="5" class="switch"></th>'+
|
||||
'<th class="next">›</th>'+
|
||||
'</tr>'+
|
||||
'</thead>',
|
||||
contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>'
|
||||
};
|
||||
DPGlobal.template = '<div class="datepicker dropdown-menu">'+
|
||||
'<div class="datepicker-days">'+
|
||||
'<table class=" table-condensed">'+
|
||||
DPGlobal.headTemplate+
|
||||
'<tbody></tbody>'+
|
||||
'</table>'+
|
||||
'</div>'+
|
||||
'<div class="datepicker-months">'+
|
||||
'<table class="table-condensed">'+
|
||||
DPGlobal.headTemplate+
|
||||
DPGlobal.contTemplate+
|
||||
'</table>'+
|
||||
'</div>'+
|
||||
'<div class="datepicker-years">'+
|
||||
'<table class="table-condensed">'+
|
||||
DPGlobal.headTemplate+
|
||||
DPGlobal.contTemplate+
|
||||
'</table>'+
|
||||
'</div>'+
|
||||
'</div>';
|
||||
|
||||
}( window.jQuery );
|
||||
///* =========================================================
|
||||
// * bootstrap-datepicker.js
|
||||
// * http://www.eyecon.ro/bootstrap-datepicker
|
||||
// * =========================================================
|
||||
// * Copyright 2012 Stefan Petre
|
||||
// *
|
||||
// * 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( $ ) {
|
||||
//
|
||||
// // Picker object
|
||||
//
|
||||
// var Datepicker = function(element, options){
|
||||
// this.element = $(element);
|
||||
// this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy');
|
||||
// this.picker = $(DPGlobal.template)
|
||||
// .appendTo('body')
|
||||
// .on({
|
||||
// click: $.proxy(this.click, this)//,
|
||||
// //mousedown: $.proxy(this.mousedown, this)
|
||||
// });
|
||||
// this.isInput = this.element.is('input');
|
||||
// this.component = this.element.is('.date') ? this.element.find('.add-on') : false;
|
||||
//
|
||||
// if (this.isInput) {
|
||||
// this.element.on({
|
||||
// focus: $.proxy(this.show, this),
|
||||
// //blur: $.proxy(this.hide, this),
|
||||
// keyup: $.proxy(this.update, this)
|
||||
// });
|
||||
// } else {
|
||||
// if (this.component){
|
||||
// this.component.on('click', $.proxy(this.show, this));
|
||||
// } else {
|
||||
// this.element.on('click', $.proxy(this.show, this));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// this.minViewMode = options.minViewMode||this.element.data('date-minviewmode')||0;
|
||||
// if (typeof this.minViewMode === 'string') {
|
||||
// switch (this.minViewMode) {
|
||||
// case 'months':
|
||||
// this.minViewMode = 1;
|
||||
// break;
|
||||
// case 'years':
|
||||
// this.minViewMode = 2;
|
||||
// break;
|
||||
// default:
|
||||
// this.minViewMode = 0;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// this.viewMode = options.viewMode||this.element.data('date-viewmode')||0;
|
||||
// if (typeof this.viewMode === 'string') {
|
||||
// switch (this.viewMode) {
|
||||
// case 'months':
|
||||
// this.viewMode = 1;
|
||||
// break;
|
||||
// case 'years':
|
||||
// this.viewMode = 2;
|
||||
// break;
|
||||
// default:
|
||||
// this.viewMode = 0;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// this.startViewMode = this.viewMode;
|
||||
// this.weekStart = options.weekStart||this.element.data('date-weekstart')||0;
|
||||
// this.weekEnd = this.weekStart === 0 ? 6 : this.weekStart - 1;
|
||||
// this.onRender = options.onRender;
|
||||
// this.fillDow();
|
||||
// this.fillMonths();
|
||||
// this.update();
|
||||
// this.showMode();
|
||||
// };
|
||||
//
|
||||
// Datepicker.prototype = {
|
||||
// constructor: Datepicker,
|
||||
//
|
||||
// show: function(e) {
|
||||
// this.picker.show();
|
||||
// this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();
|
||||
// this.place();
|
||||
// $(window).on('resize', $.proxy(this.place, this));
|
||||
// if (e ) {
|
||||
// e.stopPropagation();
|
||||
// e.preventDefault();
|
||||
// }
|
||||
// if (!this.isInput) {
|
||||
// }
|
||||
// var that = this;
|
||||
// $(document).on('mousedown', function(ev){
|
||||
// if ($(ev.target).closest('.datepicker').length == 0) {
|
||||
// that.hide();
|
||||
// }
|
||||
// });
|
||||
// this.element.trigger({
|
||||
// type: 'show',
|
||||
// date: this.date
|
||||
// });
|
||||
// },
|
||||
//
|
||||
// hide: function(){
|
||||
// this.picker.hide();
|
||||
// $(window).off('resize', this.place);
|
||||
// this.viewMode = this.startViewMode;
|
||||
// this.showMode();
|
||||
// if (!this.isInput) {
|
||||
// $(document).off('mousedown', this.hide);
|
||||
// }
|
||||
// //this.set();
|
||||
// this.element.trigger({
|
||||
// type: 'hide',
|
||||
// date: this.date
|
||||
// });
|
||||
// },
|
||||
//
|
||||
// set: function() {
|
||||
// var formated = DPGlobal.formatDate(this.date, this.format);
|
||||
// if (!this.isInput) {
|
||||
// if (this.component){
|
||||
// this.element.find('input').prop('value', formated);
|
||||
// }
|
||||
// this.element.data('date', formated);
|
||||
// } else {
|
||||
// this.element.prop('value', formated);
|
||||
// }
|
||||
// },
|
||||
//
|
||||
// setValue: function(newDate) {
|
||||
// if (typeof newDate === 'string') {
|
||||
// this.date = DPGlobal.parseDate(newDate, this.format);
|
||||
// } else {
|
||||
// this.date = new Date(newDate);
|
||||
// }
|
||||
// this.set();
|
||||
// this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0);
|
||||
// this.fill();
|
||||
// },
|
||||
//
|
||||
// place: function(){
|
||||
// var offset = this.component ? this.component.offset() : this.element.offset();
|
||||
// this.picker.css({
|
||||
// top: offset.top + this.height,
|
||||
// left: offset.left
|
||||
// });
|
||||
// },
|
||||
//
|
||||
// update: function(newDate){
|
||||
// this.date = DPGlobal.parseDate(
|
||||
// typeof newDate === 'string' ? newDate : (this.isInput ? this.element.prop('value') : this.element.data('date')),
|
||||
// this.format
|
||||
// );
|
||||
// this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0);
|
||||
// this.fill();
|
||||
// },
|
||||
//
|
||||
// fillDow: function(){
|
||||
// var dowCnt = this.weekStart;
|
||||
// var html = '<tr>';
|
||||
// while (dowCnt < this.weekStart + 7) {
|
||||
// html += '<th class="dow">'+DPGlobal.dates.daysMin[(dowCnt++)%7]+'</th>';
|
||||
// }
|
||||
// html += '</tr>';
|
||||
// this.picker.find('.datepicker-days thead').append(html);
|
||||
// },
|
||||
//
|
||||
// fillMonths: function(){
|
||||
// var html = '';
|
||||
// var i = 0
|
||||
// while (i < 12) {
|
||||
// html += '<span class="month">'+DPGlobal.dates.monthsShort[i++]+'</span>';
|
||||
// }
|
||||
// this.picker.find('.datepicker-months td').append(html);
|
||||
// },
|
||||
//
|
||||
// fill: function() {
|
||||
// var d = new Date(this.viewDate),
|
||||
// year = d.getFullYear(),
|
||||
// month = d.getMonth(),
|
||||
// currentDate = this.date.valueOf();
|
||||
// this.picker.find('.datepicker-days th:eq(1)')
|
||||
// .text(DPGlobal.dates.months[month]+' '+year);
|
||||
// var prevMonth = new Date(year, month-1, 28,0,0,0,0),
|
||||
// day = DPGlobal.getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth());
|
||||
// prevMonth.setDate(day);
|
||||
// prevMonth.setDate(day - (prevMonth.getDay() - this.weekStart + 7)%7);
|
||||
// var nextMonth = new Date(prevMonth);
|
||||
// nextMonth.setDate(nextMonth.getDate() + 42);
|
||||
// nextMonth = nextMonth.valueOf();
|
||||
// var html = [];
|
||||
// var clsName,
|
||||
// prevY,
|
||||
// prevM;
|
||||
// while(prevMonth.valueOf() < nextMonth) {
|
||||
// if (prevMonth.getDay() === this.weekStart) {
|
||||
// html.push('<tr>');
|
||||
// }
|
||||
// clsName = this.onRender(prevMonth);
|
||||
// prevY = prevMonth.getFullYear();
|
||||
// prevM = prevMonth.getMonth();
|
||||
// if ((prevM < month && prevY === year) || prevY < year) {
|
||||
// clsName += ' old';
|
||||
// } else if ((prevM > month && prevY === year) || prevY > year) {
|
||||
// clsName += ' new';
|
||||
// }
|
||||
// if (prevMonth.valueOf() === currentDate) {
|
||||
// clsName += ' active';
|
||||
// }
|
||||
// html.push('<td class="day '+clsName+'">'+prevMonth.getDate() + '</td>');
|
||||
// if (prevMonth.getDay() === this.weekEnd) {
|
||||
// html.push('</tr>');
|
||||
// }
|
||||
// prevMonth.setDate(prevMonth.getDate()+1);
|
||||
// }
|
||||
// this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
|
||||
// var currentYear = this.date.getFullYear();
|
||||
//
|
||||
// var months = this.picker.find('.datepicker-months')
|
||||
// .find('th:eq(1)')
|
||||
// .text(year)
|
||||
// .end()
|
||||
// .find('span').removeClass('active');
|
||||
// if (currentYear === year) {
|
||||
// months.eq(this.date.getMonth()).addClass('active');
|
||||
// }
|
||||
//
|
||||
// html = '';
|
||||
// year = parseInt(year/10, 10) * 10;
|
||||
// var yearCont = this.picker.find('.datepicker-years')
|
||||
// .find('th:eq(1)')
|
||||
// .text(year + '-' + (year + 9))
|
||||
// .end()
|
||||
// .find('td');
|
||||
// year -= 1;
|
||||
// for (var i = -1; i < 11; i++) {
|
||||
// html += '<span class="year'+(i === -1 || i === 10 ? ' old' : '')+(currentYear === year ? ' active' : '')+'">'+year+'</span>';
|
||||
// year += 1;
|
||||
// }
|
||||
// yearCont.html(html);
|
||||
// },
|
||||
//
|
||||
// click: function(e) {
|
||||
// e.stopPropagation();
|
||||
// e.preventDefault();
|
||||
// var target = $(e.target).closest('span, td, th');
|
||||
// if (target.length === 1) {
|
||||
// switch(target[0].nodeName.toLowerCase()) {
|
||||
// case 'th':
|
||||
// switch(target[0].className) {
|
||||
// case 'switch':
|
||||
// this.showMode(1);
|
||||
// break;
|
||||
// case 'prev':
|
||||
// case 'next':
|
||||
// this.viewDate['set'+DPGlobal.modes[this.viewMode].navFnc].call(
|
||||
// this.viewDate,
|
||||
// this.viewDate['get'+DPGlobal.modes[this.viewMode].navFnc].call(this.viewDate) +
|
||||
// DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1)
|
||||
// );
|
||||
// this.fill();
|
||||
// this.set();
|
||||
// break;
|
||||
// }
|
||||
// break;
|
||||
// case 'span':
|
||||
// if (target.is('.month')) {
|
||||
// var month = target.parent().find('span').index(target);
|
||||
// this.viewDate.setMonth(month);
|
||||
// } else {
|
||||
// var year = parseInt(target.text(), 10)||0;
|
||||
// this.viewDate.setFullYear(year);
|
||||
// }
|
||||
// if (this.viewMode !== 0) {
|
||||
// this.date = new Date(this.viewDate);
|
||||
// this.element.trigger({
|
||||
// type: 'changeDate',
|
||||
// date: this.date,
|
||||
// viewMode: DPGlobal.modes[this.viewMode].clsName
|
||||
// });
|
||||
// }
|
||||
// this.showMode(-1);
|
||||
// this.fill();
|
||||
// this.set();
|
||||
// break;
|
||||
// case 'td':
|
||||
// if (target.is('.day') && !target.is('.disabled')){
|
||||
// var day = parseInt(target.text(), 10)||1;
|
||||
// var month = this.viewDate.getMonth();
|
||||
// if (target.is('.old')) {
|
||||
// month -= 1;
|
||||
// } else if (target.is('.new')) {
|
||||
// month += 1;
|
||||
// }
|
||||
// var year = this.viewDate.getFullYear();
|
||||
// this.date = new Date(year, month, day,0,0,0,0);
|
||||
// this.viewDate = new Date(year, month, Math.min(28, day),0,0,0,0);
|
||||
// this.fill();
|
||||
// this.set();
|
||||
// this.element.trigger({
|
||||
// type: 'changeDate',
|
||||
// date: this.date,
|
||||
// viewMode: DPGlobal.modes[this.viewMode].clsName
|
||||
// });
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
//
|
||||
// mousedown: function(e){
|
||||
// e.stopPropagation();
|
||||
// e.preventDefault();
|
||||
// },
|
||||
//
|
||||
// showMode: function(dir) {
|
||||
// if (dir) {
|
||||
// this.viewMode = Math.max(this.minViewMode, Math.min(2, this.viewMode + dir));
|
||||
// }
|
||||
// this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// $.fn.datepicker = function ( option, val ) {
|
||||
// return this.each(function () {
|
||||
// var $this = $(this),
|
||||
// data = $this.data('datepicker'),
|
||||
// options = typeof option === 'object' && option;
|
||||
// if (!data) {
|
||||
// $this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options))));
|
||||
// }
|
||||
// if (typeof option === 'string') data[option](val);
|
||||
// });
|
||||
// };
|
||||
//
|
||||
// $.fn.datepicker.defaults = {
|
||||
// onRender: function(date) {
|
||||
// return '';
|
||||
// }
|
||||
// };
|
||||
// $.fn.datepicker.Constructor = Datepicker;
|
||||
//
|
||||
// var DPGlobal = {
|
||||
// modes: [
|
||||
// {
|
||||
// clsName: 'days',
|
||||
// navFnc: 'Month',
|
||||
// navStep: 1
|
||||
// },
|
||||
// {
|
||||
// clsName: 'months',
|
||||
// navFnc: 'FullYear',
|
||||
// navStep: 1
|
||||
// },
|
||||
// {
|
||||
// clsName: 'years',
|
||||
// navFnc: 'FullYear',
|
||||
// navStep: 10
|
||||
// }],
|
||||
// dates:{
|
||||
// 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"]
|
||||
// },
|
||||
// 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]
|
||||
// },
|
||||
// parseFormat: function(format){
|
||||
// var separator = format.match(/[.\/\-\s].*?/),
|
||||
// parts = format.split(/\W+/);
|
||||
// if (!separator || !parts || parts.length === 0){
|
||||
// throw new Error("Invalid date format.");
|
||||
// }
|
||||
// return {separator: separator, parts: parts};
|
||||
// },
|
||||
// parseDate: function(date, format) {
|
||||
// var parts = date.split(format.separator),
|
||||
// date = new Date(),
|
||||
// val;
|
||||
// date.setHours(0);
|
||||
// date.setMinutes(0);
|
||||
// date.setSeconds(0);
|
||||
// date.setMilliseconds(0);
|
||||
// if (parts.length === format.parts.length) {
|
||||
// var year = date.getFullYear(), day = date.getDate(), month = date.getMonth();
|
||||
// for (var i=0, cnt = format.parts.length; i < cnt; i++) {
|
||||
// val = parseInt(parts[i], 10)||1;
|
||||
// switch(format.parts[i]) {
|
||||
// case 'dd':
|
||||
// case 'd':
|
||||
// day = val;
|
||||
// date.setDate(val);
|
||||
// break;
|
||||
// case 'mm':
|
||||
// case 'm':
|
||||
// month = val - 1;
|
||||
// date.setMonth(val - 1);
|
||||
// break;
|
||||
// case 'yy':
|
||||
// year = 2000 + val;
|
||||
// date.setFullYear(2000 + val);
|
||||
// break;
|
||||
// case 'yyyy':
|
||||
// year = val;
|
||||
// date.setFullYear(val);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// date = new Date(year, month, day, 0 ,0 ,0);
|
||||
// }
|
||||
// return date;
|
||||
// },
|
||||
// formatDate: function(date, format){
|
||||
// var val = {
|
||||
// d: date.getDate(),
|
||||
// m: date.getMonth() + 1,
|
||||
// yy: date.getFullYear().toString().substring(2),
|
||||
// yyyy: date.getFullYear()
|
||||
// };
|
||||
// val.dd = (val.d < 10 ? '0' : '') + val.d;
|
||||
// val.mm = (val.m < 10 ? '0' : '') + val.m;
|
||||
// var date = [];
|
||||
// for (var i=0, cnt = format.parts.length; i < cnt; i++) {
|
||||
// date.push(val[format.parts[i]]);
|
||||
// }
|
||||
// return date.join(format.separator);
|
||||
// },
|
||||
// headTemplate: '<thead>'+
|
||||
// '<tr>'+
|
||||
// '<th class="prev">‹</th>'+
|
||||
// '<th colspan="5" class="switch"></th>'+
|
||||
// '<th class="next">›</th>'+
|
||||
// '</tr>'+
|
||||
// '</thead>',
|
||||
// contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>'
|
||||
// };
|
||||
// DPGlobal.template = '<div class="datepicker dropdown-menu">'+
|
||||
// '<div class="datepicker-days">'+
|
||||
// '<table class=" table-condensed">'+
|
||||
// DPGlobal.headTemplate+
|
||||
// '<tbody></tbody>'+
|
||||
// '</table>'+
|
||||
// '</div>'+
|
||||
// '<div class="datepicker-months">'+
|
||||
// '<table class="table-condensed">'+
|
||||
// DPGlobal.headTemplate+
|
||||
// DPGlobal.contTemplate+
|
||||
// '</table>'+
|
||||
// '</div>'+
|
||||
// '<div class="datepicker-years">'+
|
||||
// '<table class="table-condensed">'+
|
||||
// DPGlobal.headTemplate+
|
||||
// DPGlobal.contTemplate+
|
||||
// '</table>'+
|
||||
// '</div>'+
|
||||
// '</div>';
|
||||
//
|
||||
//}( window.jQuery );
|
||||
@@ -22,17 +22,15 @@ $(function($){
|
||||
};
|
||||
|
||||
// Add 1 Rule / or update the temporary Rules array then Save Rules via AJAX
|
||||
couponManager.addRuleAjax = function(id) {
|
||||
console.log('addRuleAjax '+ id);
|
||||
couponManager.createOrUpdateRuleAjax = function() {
|
||||
var id = couponManager.ruleToUpdateId;
|
||||
// If create
|
||||
if(!id) {
|
||||
console.log('pushing');
|
||||
couponManager.rulesToSave.push(couponManager.ruleToSave);
|
||||
} else { // else update
|
||||
console.log('editing ' + id);
|
||||
couponManager.rulesToSave[id] = couponManager.ruleToSave;
|
||||
// reset edit mode to off
|
||||
couponManager.ruleIdToUpdate = false;
|
||||
couponManager.ruleToUpdateId = false;
|
||||
}
|
||||
|
||||
// Save
|
||||
@@ -40,57 +38,54 @@ $(function($){
|
||||
};
|
||||
|
||||
// Set rule inputs to allow editing
|
||||
couponManager.updateRuleAjax = function(id) {
|
||||
couponManager.ruleToUpdate = couponManager.rulesToSave[id];
|
||||
console.log('Set id to edit to ' + id);
|
||||
couponManager.ruleIdToUpdate = id;
|
||||
|
||||
// Deleting this rule, we will reset it
|
||||
delete couponManager.rulesToSave[id];
|
||||
couponManager.updateRuleSelectAjax = function(id) {
|
||||
couponManager.ruleToUpdateId = id;
|
||||
couponManager.ruleToSave = couponManager.rulesToSave[id];
|
||||
|
||||
// Set the rule selector
|
||||
$("#category-rule option").filter(function() {
|
||||
return $(this).val() == couponManager.ruleToUpdate.serviceId;
|
||||
return $(this).val() == couponManager.ruleToSave.serviceId;
|
||||
}).prop('selected', true);
|
||||
|
||||
// Force rule input refresh
|
||||
couponManager.loadRuleInputs(couponManager.ruleToUpdate.serviceId, function() {
|
||||
couponManager.loadRuleInputs(couponManager.ruleToSave.serviceId, function() {
|
||||
couponManager.fillInRuleInputs();
|
||||
});
|
||||
};
|
||||
|
||||
// Fill in rule inputs
|
||||
couponManager.fillInRuleInputs = function() {
|
||||
console.log('fillInRuleInputs with');
|
||||
console.log(couponManager.ruleToUpdate);
|
||||
var operatorId = null;
|
||||
var valueId = null;
|
||||
var idName = null;
|
||||
|
||||
for (idName in couponManager.ruleToUpdate.operators) {
|
||||
var id = couponManager.ruleToUpdateId;
|
||||
if(id) {
|
||||
couponManager.ruleToSave = couponManager.rulesToSave[id];
|
||||
}
|
||||
|
||||
for (idName in couponManager.ruleToSave.operators) {
|
||||
// Setting idName operator select
|
||||
operatorId = idName + '-operator';
|
||||
$('#' + operatorId).val(couponManager.ruleToUpdate.operators[idName]);
|
||||
$('#' + operatorId).val(couponManager.ruleToSave.operators[idName]);
|
||||
|
||||
valueId = idName + '-value';
|
||||
// Setting idName value input
|
||||
$('#' + valueId).val(couponManager.ruleToUpdate.values[idName]);
|
||||
}
|
||||
couponManager.ruleToSave = couponManager.ruleToUpdate;
|
||||
|
||||
var id = couponManager.ruleIdToUpdate;
|
||||
console.log('id to edit = ' + id);
|
||||
if(id) {
|
||||
console.log('setint rulesToSave[' + id + ']');
|
||||
console.log(couponManager.ruleToSave);
|
||||
couponManager.rulesToSave[id] = couponManager.ruleToSave;
|
||||
valueId = idName + '-value';
|
||||
$('#' + valueId).val(couponManager.ruleToSave.values[idName]);
|
||||
}
|
||||
};
|
||||
|
||||
// Save rules on click
|
||||
couponManager.onClickSaveRule = function() {
|
||||
$('#constraint-save-btn').on('click', function () {
|
||||
couponManager.addRuleAjax(couponManager.ruleIdToUpdate);
|
||||
if($('#category-rule').val() == 'thelia.constraint.rule.available_for_everyone') {
|
||||
// @todo translate + modal
|
||||
var r= confirm("Do you really want to set this coupon available to everyone ?");
|
||||
if (r == true) {
|
||||
couponManager.createOrUpdateRuleAjax();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
couponManager.onClickSaveRule();
|
||||
@@ -110,7 +105,7 @@ $(function($){
|
||||
$('.constraint-update-btn').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var $this = $(this);
|
||||
couponManager.updateRuleAjax($this.attr('data-int'));
|
||||
couponManager.updateRuleSelectAjax($this.attr('data-int'));
|
||||
|
||||
// Hide row being updated
|
||||
$this.parent().parent().remove();
|
||||
@@ -120,6 +115,8 @@ $(function($){
|
||||
|
||||
// Reload effect inputs when changing effect
|
||||
couponManager.onEffectChange = function() {
|
||||
var optionSelected = $("option:selected", this);
|
||||
$('#effectToolTip').html(optionSelected.attr("data-description"));
|
||||
$('#effect').on('change', function () {
|
||||
var optionSelected = $("option:selected", this);
|
||||
$('#effectToolTip').html(optionSelected.attr("data-description"));
|
||||
@@ -130,7 +127,7 @@ $(function($){
|
||||
// Reload rule inputs when changing effect
|
||||
couponManager.onRuleChange = function() {
|
||||
$('#category-rule').on('change', function () {
|
||||
couponManager.loadRuleInputs($(this).val(), function(ruleToSave) {});
|
||||
couponManager.loadRuleInputs($(this).val(), function() {});
|
||||
});
|
||||
};
|
||||
couponManager.onRuleChange();
|
||||
@@ -139,10 +136,37 @@ $(function($){
|
||||
// var onInputsChange = function()
|
||||
// In AJAX response
|
||||
|
||||
// Set max usage to unlimited or not
|
||||
couponManager.onUsageUnlimitedChange = function() {
|
||||
if (!$('#max-usage').parent().hasClass('has-error')) {
|
||||
$('#max-usage').hide().attr('value', '-1');
|
||||
$('#max-usage-label').hide();
|
||||
}
|
||||
$('#is-unlimited').change(function(){
|
||||
var $this = $(this);
|
||||
if ($this.is(':checked')) {
|
||||
$('#max-usage').hide().attr('value', '-1');
|
||||
$('#max-usage-label').hide();
|
||||
} else {
|
||||
$('#max-usage').show().val('').attr('value', '');
|
||||
$('#max-usage-label').show();
|
||||
}
|
||||
});
|
||||
};
|
||||
couponManager.onUsageUnlimitedChange();
|
||||
|
||||
});
|
||||
|
||||
// Rule to save
|
||||
|
||||
var couponManager = {};
|
||||
// Rule to be saved
|
||||
couponManager.ruleToSave = {};
|
||||
couponManager.ruleIdToUpdate = false;
|
||||
couponManager.ruleToSave.serviceId = false;
|
||||
couponManager.ruleToSave.operators = {};
|
||||
couponManager.ruleToSave.values = {};
|
||||
// Rules payload to save
|
||||
couponManager.rulesToSave = [];
|
||||
// Rule being updated id
|
||||
couponManager.ruleToUpdateId = false;
|
||||
|
||||
|
||||
@@ -40,34 +40,7 @@
|
||||
});
|
||||
}*/
|
||||
|
||||
// -- Effect description
|
||||
if($('[name=effect]').length){
|
||||
var $effectSelect = $('[name=effect]'),
|
||||
$helpBlock = $effectSelect.next('.help-block');
|
||||
|
||||
$effectSelect.change(function(){
|
||||
var description = $(this).find(":selected").data('description');
|
||||
$helpBlock.text(description);
|
||||
});
|
||||
}
|
||||
|
||||
// -- Max usage --
|
||||
if($('#is-unlimited').length){
|
||||
|
||||
if($('#is-unlimited').is(':checked')){
|
||||
$('#max-usage').hide().attr('value', '-1');
|
||||
}
|
||||
|
||||
$('#is-unlimited').change(function(){
|
||||
if($('#is-unlimited').is(':checked')){
|
||||
$('#max-usage').hide().attr('value', '-1');
|
||||
}
|
||||
else{
|
||||
$('#max-usage').show().val('').attr('value', '');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// -- Bootstrap tooltip --
|
||||
if($('[rel="tooltip"]').length){
|
||||
|
||||
@@ -7,18 +7,19 @@
|
||||
|
||||
<nav>
|
||||
<ul class="breadcrumb">
|
||||
{include file="includes/coupon_breadcrumb.html"}
|
||||
<li><a href="{url path='admin/home'}">{intl l='Home'}</a></li>
|
||||
<li><a href="{url path='admin/coupon/'}">{intl l='Coupon'}</a></li>
|
||||
<li>{intl l='Create'}</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="page-header">
|
||||
<h1>Coupons : <small>Add a coupon</small></h1>
|
||||
<h1>{intl l='Coupons : '}<small>{intl l='Create a new coupon'}</small></h1>
|
||||
</div>
|
||||
|
||||
{form name="thelia.admin.coupon.creation"}
|
||||
{include file='coupon/form.html' formAction={url path={$formAction}} noRules=true}
|
||||
{/form}
|
||||
|
||||
</section> <!-- #wrapper -->
|
||||
|
||||
{include file='includes/confirmation-modal.html'}
|
||||
@@ -33,9 +34,20 @@
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
{javascripts file='assets/js/json2.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
{javascripts file='assets/js/coupon.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
{*<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>*}
|
||||
{*<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />*}
|
||||
<script>
|
||||
$(function($){
|
||||
miniBrowser(0, '/test_to_remove/datas_coupon_edit.json');
|
||||
{*$('.datepicker').datepicker({ dateFormat: "{$dateFormat}", defaultDate: +60, minDate: "+0m" });*}
|
||||
});
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
|
||||
@@ -7,70 +7,50 @@
|
||||
|
||||
<nav>
|
||||
<ul class="breadcrumb">
|
||||
{include file="includes/coupon_breadcrumb.html"}
|
||||
<li><a href="{url path='admin/home'}">{intl l='Home'}</a></li>
|
||||
<li><a href="{url path='admin/coupon/'}">{intl l='Coupon'}</a></li>
|
||||
<li>{intl l='Browse'}</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="page-header">
|
||||
<h1>Coupons : <small>List of coupons</small></h1>
|
||||
<h1>{intl l='Coupons : '}<small>{intl l='List'}</small></h1>
|
||||
<a href="{$urlCreateCoupon}" class="btn btn-default btn-primary btn-medium">
|
||||
<span class="glyphicon glyphicon-add"></span> {intl l='Create a new coupon'}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<section class="row">
|
||||
<div class="col-md-12 general-block-decorator">
|
||||
<table class="table table-striped tablesorter">
|
||||
<caption>
|
||||
List of enabled coupons
|
||||
{intl l='Enabled coupons'}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Code</th>
|
||||
<th>Title</th>
|
||||
<th>Expiration date</th>
|
||||
<th>Usage left</th>
|
||||
<th class="sorter-false filter-false">Actions</th>
|
||||
<th>{block name="coupon-label-code"}{intl l='Code'}{/block}</th>
|
||||
<th>{block name="coupon-label-title"}{intl l='Title'}{/block}</th>
|
||||
<th>{block name="coupon-label-expiration-date"}{intl l='Expiration date'}{/block}</th>
|
||||
<th>{block name="coupon-label-usage-left"}{intl l='Usage left'}{/block}</th>
|
||||
<th class="sorter-false filter-false">{block name="coupon-label-action"}{/block}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="#">XMAS13</a></td>
|
||||
<td>Coupon for XMAS -30 €</td>
|
||||
<td>18/10/2013</td>
|
||||
<td>49</td>
|
||||
<td>
|
||||
<a href="#url" class="btn btn-default btn-primary btn-medium"><span class="glyphicon glyphicon-edit"></span> Edit</a>
|
||||
<a href="#url" class="btn btn-default btn-danger btn-medium" data-toggle="confirm" data-target="#disable"><span class="glyphicon glyphicon-off"></span> Disable</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#">XMAS13</a></td>
|
||||
<td>Coupon for XMAS -30 €</td>
|
||||
<td>05/09/2013</td>
|
||||
<td>20</td>
|
||||
<td>
|
||||
<a href="#url" class="btn btn-default btn-primary btn-medium"><span class="glyphicon glyphicon-edit"></span> Edit</a>
|
||||
<a href="#url" class="btn btn-default btn-danger btn-medium" data-toggle="confirm" data-target="#disable"><span class="glyphicon glyphicon-off"></span> Disable</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#">XMAS13</a></td>
|
||||
<td>Coupon for XMAS -30 €</td>
|
||||
<td>03/12/2013</td>
|
||||
<td>9</td>
|
||||
<td>
|
||||
<a href="#url" class="btn btn-default btn-primary btn-medium"><span class="glyphicon glyphicon-edit"></span> Edit</a>
|
||||
<a href="#url" class="btn btn-default btn-danger btn-medium" data-toggle="confirm" data-target="#disable"><span class="glyphicon glyphicon-off"></span> Disable</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#">XMAS13</a></td>
|
||||
<td>Coupon for XMAS -30 €</td>
|
||||
<td>25/01/2013</td>
|
||||
<td>4</td>
|
||||
<td>
|
||||
<a href="#url" class="btn btn-default btn-primary btn-medium"><span class="glyphicon glyphicon-edit"></span> Edit</a>
|
||||
<a href="#url" class="btn btn-default btn-danger btn-medium" data-toggle="confirm" data-target="#disable"><span class="glyphicon glyphicon-off"></span> Disable</a>
|
||||
</td>
|
||||
</tr>
|
||||
{loop type="coupon" name="list_coupon" is_enabled="1" backend_context="true"}
|
||||
<tr>
|
||||
<td>{block name="coupon-code"}<a href="{$urlReadCoupon|replace:'couponId':$ID}">{$CODE}</a>{/block}</td>
|
||||
<td>{block name="coupon-title"}{$TITLE}{/block}</td>
|
||||
<td>{block name="coupon-expiration-date"}{$EXPIRATION_DATE}{/block}</td>
|
||||
<td>{block name="coupon-usage-left"}{$USAGE_LEFT}{/block}</td>
|
||||
<td>
|
||||
{block name="coupon-action"}
|
||||
<a href="{$urlEditCoupon|replace:'couponId':$ID}" class="btn btn-default btn-primary btn-medium">
|
||||
<span class="glyphicon glyphicon-edit"></span> {intl l='Edit'}
|
||||
</a>
|
||||
{/block}
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -80,58 +60,33 @@
|
||||
<div class="col-md-12 general-block-decorator">
|
||||
<table class="table table-striped tablesorter">
|
||||
<caption>
|
||||
List of disabled coupons
|
||||
{intl l='Disabled coupons'}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Code</th>
|
||||
<th>Title</th>
|
||||
<th>Expiration date</th>
|
||||
<th>Usage left</th>
|
||||
<th class="sorter-false filter-false">Actions</th>
|
||||
<th>{block name="coupon-label-code"}{intl l='Code'}{/block}</th>
|
||||
<th>{block name="coupon-label-title"}{intl l='Title'}{/block}</th>
|
||||
<th>{block name="coupon-label-expiration-date"}{intl l='Expiration date'}{/block}</th>
|
||||
<th>{block name="coupon-label-usage-left"}{intl l='Usage left'}{/block}</th>
|
||||
<th class="sorter-false filter-false">{block name="coupon-label-action"}{/block}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>XMAS13</td>
|
||||
<td>Coupon for XMAS -30 €</td>
|
||||
<td>18/10/2013</td>
|
||||
<td>49</td>
|
||||
<td>
|
||||
<a href="#url" class="btn btn-default btn-primary btn-medium"><span class="glyphicon glyphicon-edit"></span> Edit</a>
|
||||
<a href="#url" class="btn btn-default btn-success btn-medium" data-toggle="confirm" data-target="#enable"><span class="glyphicon glyphicon-ok"></span> Enabled</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>XMAS13</td>
|
||||
<td>Coupon for XMAS -20 €</td>
|
||||
<td>05/09/2013</td>
|
||||
<td>49</td>
|
||||
<td>
|
||||
<a href="#url" class="btn btn-default btn-primary btn-medium"><span class="glyphicon glyphicon-edit"></span> Edit</a>
|
||||
<a href="#url" class="btn btn-default btn-success btn-medium" data-toggle="confirm" data-target="#enable"><span class="glyphicon glyphicon-ok"></span> Enabled</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>XMAS13</td>
|
||||
<td>Coupon for XMAS -50 €</td>
|
||||
<td>03/12/2013</td>
|
||||
<td>49</td>
|
||||
<td>
|
||||
<a href="#url" class="btn btn-default btn-primary btn-medium"><span class="glyphicon glyphicon-edit"></span> Edit</a>
|
||||
<a href="#url" class="btn btn-default btn-success btn-medium" data-toggle="confirm" data-target="#enable"><span class="glyphicon glyphicon-ok"></span> Enabled</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>XMAS13</td>
|
||||
<td>Coupon for XMAS -5 €</td>
|
||||
<td>25/01/2013</td>
|
||||
<td>49</td>
|
||||
<td>
|
||||
<a href="#url" class="btn btn-default btn-primary btn-medium"><span class="glyphicon glyphicon-edit"></span> Edit</a>
|
||||
<a href="#url" class="btn btn-default btn-success btn-medium" data-toggle="confirm" data-target="#enable"><span class="glyphicon glyphicon-ok"></span> Enabled</a>
|
||||
</td>
|
||||
</tr>
|
||||
{loop type="coupon" name="list_coupon" is_enabled="0" backend_context="true"}
|
||||
<tr>
|
||||
<td>{block name="coupon-code"}<a href="{$urlReadCoupon|replace:'couponId':$ID}">{$CODE}</a>{/block}</td>
|
||||
<td>{block name="coupon-title"}{$TITLE}{/block}</td>
|
||||
<td>{block name="coupon-expiration-date"}{$EXPIRATION_DATE}{/block}</td>
|
||||
<td>{block name="coupon-usage-left"}{$USAGE_LEFT}{/block}</td>
|
||||
<td>
|
||||
{block name="coupon-action"}
|
||||
<a href="{$urlEditCoupon|replace:'couponId':$ID}" class="btn btn-default btn-primary btn-medium">
|
||||
<span class="glyphicon glyphicon-edit"></span> {intl l='Edit'}
|
||||
</a>
|
||||
{/block}
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -139,9 +94,6 @@
|
||||
|
||||
</section> <!-- #wrapper -->
|
||||
|
||||
{include file='includes/confirmation-modal.html' id="disable" message="{intl l='Do you really want to disable this element ?'}"}
|
||||
{include file='includes/confirmation-modal.html' id="enable" message="{intl l='Do you really want to enable this element ?'}"}
|
||||
|
||||
{/block}
|
||||
|
||||
|
||||
|
||||
@@ -4,112 +4,146 @@
|
||||
|
||||
{block name="main-content"}
|
||||
<section id="wrapper" class="container">
|
||||
|
||||
{loop type="coupon" name="read_coupon" id={$couponId} backend_context="true"}
|
||||
<nav>
|
||||
<ul class="breadcrumb">
|
||||
{include file="includes/coupon_breadcrumb.html"}
|
||||
<li><a href="{url path='admin/home'}">{intl l='Home'}</a></li>
|
||||
<li><a href="{url path='admin/coupon/'}">{intl l='Coupon'}</a></li>
|
||||
<li>{$CODE}</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
{loop type="coupon" name="read_coupon" id={$couponId} backend_context="true"}
|
||||
<div class="page-header">
|
||||
<h1>{intl l='Coupon : '}<small>{$CODE}</small></h1>
|
||||
</div>
|
||||
|
||||
<div class="page-header">
|
||||
<h1>{intl l='Coupon : '}<small>{$CODE}</small></h1>
|
||||
</div>
|
||||
|
||||
<section class="row">
|
||||
<div class="col-md-12 general-block-decorator">
|
||||
<section class="row">
|
||||
<div class="col-md-12 general-block-decorator">
|
||||
|
||||
<div class="alert alert-info">
|
||||
<span class="glyphicon glyphicon-question-sign"></span>
|
||||
{if !$IS_ENABLED}{intl l='This coupon is disabled, you can enable to the bottom of this form.'}{/if}
|
||||
</div>
|
||||
{if !$IS_ENABLED}
|
||||
<div class="alert alert-info">
|
||||
<span class="glyphicon glyphicon-question-sign"></span>
|
||||
{intl l='This coupon is disabled, you can enable to the bottom of this form.'}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{intl l='Title'}</td>
|
||||
<td>{$TITLE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Expiration date'}</td>
|
||||
<td>{$EXPIRATION_DATE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Usage left'}</td>
|
||||
<td>
|
||||
{if $USAGE_LEFT}
|
||||
<span class="label label-success">
|
||||
{$USAGE_LEFT}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-important">
|
||||
0
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">{$SHORT_DESCRIPTION}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">{$DESCRIPTION}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{if $IS_CUMULATIVE}
|
||||
<span class="label label-success">
|
||||
{intl l="May be cumulative"}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-important">
|
||||
{intl l="Can't be cumulative"}
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{if $IS_REMOVING_POSTAGE}
|
||||
<span class="label label-important">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{intl l='Title'}</td>
|
||||
<td>{$TITLE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{if $IS_ENABLED}
|
||||
<span class="label label-success">
|
||||
{intl l="Is enabled"}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-warning">
|
||||
{intl l="Is disabled"}
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{$TOOLTIP}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Amount'}</td>
|
||||
<td>{$AMOUNT}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Expiration date'}</td>
|
||||
<td>{$EXPIRATION_DATE} ({$DAY_LEFT_BEFORE_EXPIRATION} {intl l="days left"})</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Usage left'}</td>
|
||||
<td>
|
||||
{if $USAGE_LEFT}
|
||||
<span class="label label-success">
|
||||
{$USAGE_LEFT}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-warning">
|
||||
0
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{if $IS_CUMULATIVE}
|
||||
<span class="label label-success">
|
||||
{intl l="May be cumulative"}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-warning">
|
||||
{intl l="Can't be cumulative"}
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{if $IS_REMOVING_POSTAGE}
|
||||
<span class="label label-warning">
|
||||
{intl l="Will remove postage"}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-success">
|
||||
{else}
|
||||
<span class="label label-success">
|
||||
{intl l="Won't remove postage"}
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Amount'}</td>
|
||||
<td>{$AMOUNT}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Application field'}</td>
|
||||
<td>
|
||||
<ul class="list-unstyled">
|
||||
{foreach from=$APPLICATION_CONDITIONS item=rule name=rulesForeach}
|
||||
{if !$smarty.foreach.rulesForeach.first}
|
||||
<li><span class="label label-info">{intl l='And'}</span></li>
|
||||
{/if}
|
||||
<li>{$rule nofilter}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Actions'}</td>
|
||||
<td>
|
||||
<a href="#url" class="btn btn-default btn-primary btn-medium"><span class="icon-edit icon-white"></span> {intl l='Edit'}</a>
|
||||
<a href="#url" class="btn btn-default btn-success btn-medium" data-toggle="confirm" data-target="#enable"><span class="glyphicon glyphicon-ok"></span> {intl l='Enabled'}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{/loop}
|
||||
</div>
|
||||
</section>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{if $IS_AVAILABLE_ON_SPECIAL_OFFERS}
|
||||
<span class="label label-warning">
|
||||
{intl l="Will be available on special offers"}
|
||||
</span>
|
||||
{else}
|
||||
<span class="label label-success">
|
||||
{intl l="Won't be available on special offers"}
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{intl l='Application field'}</td>
|
||||
<td>
|
||||
<ul class="list-unstyled">
|
||||
{foreach from=$APPLICATION_CONDITIONS item=rule name=rulesForeach}
|
||||
{if !$smarty.foreach.rulesForeach.first}
|
||||
<li><span class="label label-info">{intl l='And'}</span></li>
|
||||
{/if}
|
||||
<li>{$rule nofilter}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">{$SHORT_DESCRIPTION}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">{$DESCRIPTION}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<a href="{$urlEditCoupon}" class="btn btn-default btn-primary btn-medium">
|
||||
<span class="icon-edit icon-white"></span> {intl l='Edit'}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
{/loop}
|
||||
</section> <!-- #wrapper -->
|
||||
|
||||
{include file='includes/confirmation-modal.html' id="enable" message="{intl l='Do you really want to enable this element ?'}"}
|
||||
|
||||
@@ -7,19 +7,20 @@
|
||||
|
||||
<nav>
|
||||
<ul class="breadcrumb">
|
||||
{include file="includes/coupon_breadcrumb.html"}
|
||||
<li><a href="{url path='admin/home'}">{intl l='Home'}</a></li>
|
||||
<li><a href="{url path='admin/coupon/'}">{intl l='Coupon'}</a></li>
|
||||
<li>{intl l='Update'} {$couponCode}</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="page-header">
|
||||
<h1>Coupons : <small>Update a coupon</small></h1>
|
||||
<h1>{intl l='Coupons : '}<small>{intl l='Update'} {$couponCode}</small></h1>
|
||||
</div>
|
||||
|
||||
{form name="thelia.admin.coupon.creation"}
|
||||
{include file='coupon/form.html' formAction={url path={$formAction}} form=$form noRules=false}
|
||||
{/form}
|
||||
|
||||
|
||||
</section> <!-- #wrapper -->
|
||||
{/block}
|
||||
|
||||
@@ -71,8 +72,6 @@
|
||||
// Save Rules AJAX
|
||||
couponManager.saveRuleAjax = function() {
|
||||
$('#constraint-add-operators-values').html('<div class="loading" ></div>');
|
||||
console.log('about to save');
|
||||
console.log(couponManager.rulesToSave);
|
||||
var $url = '{$urlAjaxUpdateRules}';
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
@@ -88,6 +87,11 @@
|
||||
}).done(function(data) {
|
||||
$('#constraint-list').html(data);
|
||||
$('#constraint-add-operators-values').html('');
|
||||
// Set the rule selector
|
||||
$("#category-rule option").filter(function() {
|
||||
return $(this).val() == 'thelia.constraint.rule.available_for_everyone';
|
||||
}).prop('selected', true);
|
||||
|
||||
couponManager.onClickUpdateRule();
|
||||
couponManager.onClickDeleteRule();
|
||||
});
|
||||
@@ -109,13 +113,22 @@
|
||||
}
|
||||
}).done(function(data) {
|
||||
$('#constraint-add-operators-values').html(data);
|
||||
|
||||
couponManager.ruleToSave.serviceId = ruleId;
|
||||
if (ruleId == -1) {
|
||||
// Placeholder can't be saved
|
||||
$('#constraint-save-btn').hide();
|
||||
} else {
|
||||
$('#constraint-save-btn').show();
|
||||
}
|
||||
return callBack();
|
||||
});
|
||||
};
|
||||
|
||||
// Rules which will be saved
|
||||
couponManager.rulesToSave = couponManager.initRules();
|
||||
|
||||
$('#constraint-save-btn').hide();
|
||||
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
|
||||
@@ -11,152 +11,155 @@
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/coupon/read/{id}'}" />
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/coupon/update/{id}/'}" />
|
||||
{/form_field}
|
||||
|
||||
<div class="span4">
|
||||
<div class="control-group">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="code">{intl l='Code :'}</label>
|
||||
{form_field form=$form field='code'}
|
||||
{form_field form=$form field='code'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label class="control-label" for="code">{intl l='Code :'}</label>
|
||||
<input id="code" class="form-control" type="text" name="{$name}" value="{$value}" placeholder="{intl l='code'}">
|
||||
{if $error}{$message}{/if}
|
||||
{/form_field}
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title">{intl l='Title :'}</label>
|
||||
{form_field form=$form field='title'}
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="title" class="control-label" >{intl l='Title :'}</label>
|
||||
<input id="title" class="form-control" type="text" name="{$name}" value="{$value}" placeholder="{intl l='title'}">
|
||||
{if $error}{$message}{/if}
|
||||
{/form_field}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="enabled" class="checkbox">
|
||||
{form_field form=$form field='isEnabled'}
|
||||
<input id="enabled" type="checkbox" name="{$name}" {if $value}value="1" checked{else}value="0"{/if} >
|
||||
{if $error}{$message}{/if}
|
||||
{/form_field}
|
||||
{intl l='Is enabled ?'}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="available-on-special-offers" class="checkbox">
|
||||
{form_field form=$form field='isAvailableOnSpecialOffers'}
|
||||
<input id="available-on-special-offers" type="checkbox" name="{$name}" {if $value}value="1" checked{else}value="0"{/if} >
|
||||
{if $error}{$message}{/if}
|
||||
{/form_field}
|
||||
{intl l='Is available on special offers ?'}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="cumulative" class="checkbox">
|
||||
{form_field form=$form field='isCumulative'}
|
||||
<input id="cumulative" type="checkbox" name="{$name}" {if $value}value="1" checked{else}value="0"{/if} >
|
||||
{if $error}{$message}{/if}
|
||||
{/form_field}
|
||||
{intl l='Is cumulative ?'}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="renoving-postage" class="checkbox">
|
||||
{form_field form=$form field='isRemovingPostage'}
|
||||
<input id="renoving-postage" type="checkbox" name="{$name}" {if $value}value="1" checked{else}value="0"{/if} >
|
||||
{if $error}{$message}{/if}
|
||||
{/form_field}
|
||||
{intl l='Is removing postage ?'}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="expiration-date">{intl l='Expiration date :'}</label>
|
||||
<div class="input-append date" data-date="12/02/2012" data-date-format="dd/mm/yyyy">
|
||||
{form_field form=$form field='expirationDate'}
|
||||
<input type="text" id="expiration-date" name="{$name}" value="{if $defaultDate}{$defaultDate}{else}{$value}{/if}">
|
||||
{if $error}{$message}{/if}
|
||||
{/form_field}
|
||||
<span class="add-on"><span class="icon-th"></span></span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<div class="form-group">
|
||||
<label for="max-usage">{intl l='Max usage :'}</label>
|
||||
<label for="is-unlimited" class="checkbox">
|
||||
<input id="is-unlimited" type="checkbox" name="is-unlimited" checked >
|
||||
{intl l='Is unlimited ?'}
|
||||
</label>
|
||||
{form_field form=$form field='maxUsage'}
|
||||
{form_field form=$form field='isEnabled'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="is-enabled" class="checkbox control-label">
|
||||
<input id="is-enabled" type="checkbox" name="{$name}" {if $value}value="1" checked{else}value="0"{/if} >
|
||||
{if $error}{$message}{/if}
|
||||
{intl l='Is enabled'}
|
||||
</label>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='isAvailableOnSpecialOffers'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="is-available-on-special-offers" class="checkbox control-label">
|
||||
<input id="is-available-on-special-offers" type="checkbox" name="{$name}" {if $value}value="1" checked{else}value="0"{/if} >
|
||||
{if $error}{$message}{/if}
|
||||
{intl l='Is available on special offers'}
|
||||
</label>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='isCumulative'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="is-cumulative" class="checkbox control-label">
|
||||
<input id="is-cumulative" type="checkbox" name="{$name}" {if $value}value="1" checked{else}value="0"{/if} >
|
||||
{if $error}{$message}{/if}
|
||||
{intl l='Is cumulative'}
|
||||
</label>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='isRemovingPostage'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="is-removing-postage" class="checkbox control-label">
|
||||
<input id="is-removing-postage" type="checkbox" name="{$name}" {if $value}value="1" checked{else}value="0"{/if} >
|
||||
{if $error}{$message}{/if}
|
||||
{intl l='Is removing postage'}
|
||||
</label>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='expirationDate'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="expiration-date" class="control-label">{intl l='Expiration date :'}</label>
|
||||
<div class="input-append date" data-date="12/02/2012" data-date-format="dd/mm/yyyy">
|
||||
<input type="text" id="expiration-date" name="{$name}" class="form-control datepicker" data-date-format="yyyy-mm-dd" value="{if $defaultDate}{$defaultDate}{else}{$value}{/if}" placeholder="{intl l='yyyy-mm-dd'}">
|
||||
{if $error}{$message}{/if}
|
||||
<span class="add-on"><span class="icon-th"></span></span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='maxUsage'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
|
||||
<label for="is-unlimited" class="checkbox control-label">
|
||||
<input id="is-unlimited" type="checkbox" name="is-unlimited" {if $error}{else}checked{/if} >
|
||||
{intl l='Is unlimited'}
|
||||
</label>
|
||||
<label id="max-usage-label" for="max-usage" class="control-label">{intl l='Max usage :'}</label>
|
||||
<input id="max-usage" type="text" class="form-control" name="{$name}" value="{$value}" placeholder="{intl l='max usage'}">
|
||||
{if $error}{$message}{/if}
|
||||
{/form_field}
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
|
||||
<div class="col-md-8">
|
||||
<div class="well clearfix">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="effect">{intl l='Effect :'}</label>
|
||||
{form_field form=$form field='effect'}
|
||||
{form_field form=$form field='effect'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="effect" class="control-label">{intl l='Effect :'}</label>
|
||||
<select name="{$name}" value="{$value}" id="effect" class="col-md-12 form-control">
|
||||
<option value="-1" data-description="">{intl l='Please select an effect'}</option>
|
||||
{foreach from=$availableCoupons item=availableCoupon}
|
||||
<option value="{$availableCoupon.serviceId}" data-description="{$availableCoupon.toolTip}">{$availableCoupon.name}</option>
|
||||
<option value="{$availableCoupon.serviceId}" data-description="{$availableCoupon.toolTip}" {if $value == $availableCoupon.serviceId}selected="selected"{/if}>{$availableCoupon.name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
{if $error}{$message}{/if}
|
||||
{/form_field}
|
||||
<span id="effectToolTip" class="help-block">{$availableCoupons.0.toolTip}</span>
|
||||
</div>
|
||||
<span id="effectToolTip" class="help-block">{$availableCoupons.0.toolTip}</span>
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="amount">{intl l='Amount :'}</label>
|
||||
{form_field form=$form field='amount'}
|
||||
{form_field form=$form field='amount'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
{$value}
|
||||
<label for="amount" class="control-label">{intl l='Amount :'}</label>
|
||||
<input id="amount" type="text" class="form-control" name="{$name}" value="{$value}" placeholder="{intl l='14.50'}">
|
||||
{if $error}{$message}{/if}
|
||||
{/form_field}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="category">Category :</label>
|
||||
</div>
|
||||
{/form_field}
|
||||
{*<div class="form-group {if $error}has-error{/if}">*}
|
||||
{*<label for="category">Category :</label>*}
|
||||
{*form_field form=$form field='category'*}
|
||||
<select name="{$name}" value="{$value}" id="category" class="form-control">
|
||||
<option value="1">Category 1</option>
|
||||
<option value="1">Category 2</option>
|
||||
<option value="1">Category 3</option>
|
||||
</select>
|
||||
{*<select name="{$name}" value="{$value}" id="category" class="form-control">*}
|
||||
{*<option value="1">Category 1</option>*}
|
||||
{*<option value="1">Category 2</option>*}
|
||||
{*<option value="1">Category 3</option>*}
|
||||
{*</select>*}
|
||||
{*if $error}{$message}{/if}*}
|
||||
{*/form_field*}
|
||||
</div>
|
||||
{*</div>*}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="short-description">{intl l='Short description :'}</label>
|
||||
{form_field form=$form field='shortDescription'}
|
||||
<textarea id="short-description" name="{$name}" placeholder="{intl l='short description'}" class="span12" rows="5">{$value nofilter}</textarea>
|
||||
{form_field form=$form field='shortDescription'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="short-description" class="control-label">{intl l='Short description :'}</label>
|
||||
<textarea id="short-description" name="{$name}" class="form-control" placeholder="{intl l='short description'}" class="span12" rows="5">{$value nofilter}</textarea>
|
||||
{if $error}{$message}{/if}
|
||||
{/form_field}
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<div class="col-md-12">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="description">{intl l='Long description :'}</label>
|
||||
{form_field form=$form field='description'}
|
||||
{form_field form=$form field='description'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="description" class="control-label">{intl l='Long description :'}</label>
|
||||
<textarea id="description" name="{$name}" placeholder="{intl l='long description'}" class="form-control wysiwyg" rows="10">{$value nofilter}</textarea>
|
||||
{if $error}{$message}{/if}
|
||||
{/form_field}
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<button type="submit" class="btn btn-default btn-primary">{intl l='Save'}</button>
|
||||
<button id="save-coupon-btn" type="submit" class="btn btn-default btn-primary">{intl l='Save your modifications'}</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -186,22 +189,23 @@
|
||||
<section class="row">
|
||||
<div class="col-md-12 general-block-decorator clearfix">
|
||||
<a id="constraint-save-btn" title="{intl l='Save this rule'}" class="btn btn-default btn-primary pull-right">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
<span class="glyphicon glyphicon-plus-sign"></span> {intl l='Save this rule'}
|
||||
</a>
|
||||
|
||||
<div id="rule-add-organizer" class="form-group col-md-2">
|
||||
<label for="type">{intl l='Condition type :'}</label>
|
||||
<label class="radio">
|
||||
<input type="radio" name="type" id="type" value="1" checked> {intl l='And'}
|
||||
<input type="radio" name="type" class="form-control" id="type" value="1" checked> {intl l='And'}
|
||||
</label>
|
||||
<label class="radio">
|
||||
<input type="radio" name="type" value="2"> {intl l='Or'}
|
||||
<input type="radio" name="type" class="form-control" value="2"> {intl l='Or'}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div id="rule-add-type" class="form-group col-md-4">
|
||||
<label for="categoryRule">{intl l='Rule\'s category :'}</label>
|
||||
<select name="categoryRule" id="category-rule" class="form-control">
|
||||
<option value="-1" >{intl l='Please select a rule category'}</option>
|
||||
{foreach from=$availableRules item=availableRule}
|
||||
<option value="{$availableRule.serviceId}" data-description="{$availableRule.toolTip}">{$availableRule.name}</option>
|
||||
{/foreach}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<select class="form-control" id="{$name}-operator" name="{$name}[operator]">
|
||||
{foreach from=$input.availableOperators key=k item=availableOperator}
|
||||
{foreach from=$input.availableOperators key=k item=availableOperator name=availableOperators}
|
||||
<option value="{$k}">{$availableOperator}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="input-group col-lg-6">
|
||||
{if $input.type == 'select'}
|
||||
<select class="{$input.class}" id="{$name}-value" name="{$name}[value]">
|
||||
{foreach from=$input.availableValues key=code item=availableValue}
|
||||
{foreach from=$input.availableValues key=code item=availableValue name=availableValues}
|
||||
<option value="{$code}">{$availableValue}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
@@ -72,12 +72,16 @@
|
||||
<script>
|
||||
|
||||
// Init Rules to set
|
||||
couponManager.ruleToSave['serviceId'] = '{$ruleId}';
|
||||
couponManager.ruleToSave['operators'] = {literal}{}{/literal};
|
||||
couponManager.ruleToSave['values'] = {literal}{}{/literal};
|
||||
// Update only if no rule are already set
|
||||
if(!couponManager.ruleToSave){
|
||||
couponManager.ruleToSave['serviceId'] = '{$ruleId}';
|
||||
couponManager.ruleToSave['operators'] = {literal}{}{/literal};
|
||||
couponManager.ruleToSave['values'] = {literal}{}{/literal};
|
||||
} else {
|
||||
}
|
||||
{foreach from=$inputs.inputs key=name item=input}
|
||||
couponManager.ruleToSave['operators']['{$name nofilter}'] = '{foreach from=$inputs.inputs[$name].availableOperators key=keyOperator item=valueOperator name=operators}{if $smarty.foreach.operators.first}{$keyOperator nofilter}{/if}{/foreach}';
|
||||
couponManager.ruleToSave['values']['{$name nofilter}'] = '{if count($inputs.inputs[$name].availableValues) != 0}{foreach from=$inputs.inputs[$name].availableValues key=keyValue item=valueValue name=values}{if $smarty.foreach.values.first}{$keyValue nofilter}{/if}{/foreach}{else}to set{/if}';
|
||||
couponManager.ruleToSave['operators']['{$name nofilter}'] = '{foreach from=$inputs.inputs[$name].availableOperators key=keyOperator item=valueOperator name=operators}{if $smarty.foreach.operators.first}{$keyOperator nofilter}{/if}{/foreach}';
|
||||
couponManager.ruleToSave['values']['{$name nofilter}'] = '{if count($inputs.inputs[$name].availableValues) != 0}{foreach from=$inputs.inputs[$name].availableValues key=keyValue item=valueValue name=values}{if $smarty.foreach.values.first}{$keyValue nofilter}{/if}{/foreach}{else}to set{/if}';
|
||||
{/foreach}
|
||||
|
||||
|
||||
@@ -86,13 +90,11 @@
|
||||
{foreach from=$inputs.inputs key=name item=input}
|
||||
// Operator selector
|
||||
$('#{$name}-operator').change(function (e) {
|
||||
console.log('changin operator');
|
||||
var $this = $(this);
|
||||
couponManager.ruleToSave['operators']['{$name nofilter}'] = $this.val();
|
||||
});
|
||||
// Value input
|
||||
$('#{$name}-value').change(function (e) {
|
||||
console.log('changin value');
|
||||
var $this = $(this);
|
||||
couponManager.ruleToSave['values']['{$name nofilter}'] = $this.val();
|
||||
});
|
||||
|
||||
316
templates/admin/default/feature-edit.html
Normal file
316
templates/admin/default/feature-edit.html
Normal file
@@ -0,0 +1,316 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="page-title"}{intl l='Edit an feature'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.features.edit{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="features edit-feature">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
{loop name="feature_edit" type="feature" id=$feature_id backend_context="1" lang=$edit_language_id}
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration/features'}">{intl l="Features"}</a></li>
|
||||
<li>{intl l='Editing feature "%name"' name="{$TITLE}"}</li>
|
||||
</ul>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 general-block-decorator">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12 title title-without-tabs">
|
||||
{intl l="Edit feature $TITLE"}
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="form-container">
|
||||
{form name="thelia.admin.feature.modification"}
|
||||
<form method="POST" action="{url path='/admin/configuration/features/save'}" {form_enctype form=$form} class="clearfix">
|
||||
|
||||
{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/configuration/features'}"}
|
||||
|
||||
<div class="col-md-6">
|
||||
|
||||
<p class="title title-without-tabs">{intl l='Feature information'}</p>
|
||||
|
||||
{form_field form=$form field='id'}
|
||||
<input type="hidden" name="{$name}" value="{$feature_id}" />
|
||||
{/form_field}
|
||||
|
||||
{* Be sure to get the feature ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="feature_id" value="{$feature_id}" />
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/features'}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
|
||||
{/form_field}
|
||||
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
|
||||
{include file="includes/standard-description-form-fields.html" form=$form}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
|
||||
<p class="title title-without-tabs">
|
||||
|
||||
{intl l='Feature values'}
|
||||
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.feature-av.create"}
|
||||
<span class="pull-right">
|
||||
<a data-toggle="modal" href="#creation_dialog" title="Add a new feature value" class="btn btn-default btn-primary">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
</span>
|
||||
{/loop}
|
||||
</p>
|
||||
|
||||
<div class="alert alert-info">
|
||||
{intl l="Enter here all possible feature values."}
|
||||
</div>
|
||||
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
{admin_sortable_header
|
||||
current_order=$featureav_order
|
||||
order='id'
|
||||
reverse_order='id_reverse'
|
||||
request_parameter_name='featureav_order'
|
||||
path={url path='/admin/configuration/features/update' feature_id=$feature_id}
|
||||
label="{intl l='ID'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th>
|
||||
{admin_sortable_header
|
||||
current_order=$featureav_order
|
||||
order='alpha'
|
||||
reverse_order='alpha_reverse'
|
||||
request_parameter_name='featureav_order'
|
||||
path={url path='/admin/configuration/features/update' feature_id=$feature_id}
|
||||
label="{intl l='Value'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th class="text-center">
|
||||
{admin_sortable_header
|
||||
current_order=$featureav_order
|
||||
order='manual'
|
||||
reverse_order='manual_reverse'
|
||||
request_parameter_name='featureav_order'
|
||||
path={url path='/admin/configuration/features/update' feature_id=$feature_id}
|
||||
label="{intl l="Position"}"
|
||||
}
|
||||
</th>
|
||||
|
||||
{module_include location='features_value_table_header'}
|
||||
|
||||
<th class="actions">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="list" type="feature_availability" feature=$feature_id backend_context="1" lang=$edit_language_id order=$featureav_order}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
|
||||
<td>
|
||||
{* FIXME : integrate this in the encolsing form to provide standard form processing *}
|
||||
<input class="js-edit form-control" type="text" name="feature_values[{$ID}]" value="{$TITLE}" />
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
permission="admin.features.edit"
|
||||
path={url path='/admin/configuration/features-av/update-position' feature_id=$feature_id}
|
||||
url_parameter="featureav_id"
|
||||
in_place_edit_class="positionChange"
|
||||
position="$POSITION"
|
||||
id="$ID"
|
||||
}
|
||||
</td>
|
||||
|
||||
{module_include location='features_value_table_row'}
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.feature-av.delete"}
|
||||
<a class="btn btn-default btn-xs value-delete" title="{intl l='Delete this value'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="list"}
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="alert alert-info">
|
||||
{intl l="No value has been created yet. Click the + button to create one."}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="feature_edit"}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-error">
|
||||
{intl l="Sorry, feature ID=$feature_id was not found."}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/elseloop}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* Adding a new feature *}
|
||||
|
||||
{form name="thelia.admin.featureav.creation"}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
|
||||
{capture "creation_dialog"}
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{* Be sure to get the feature ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="feature_id" value="{$feature_id}" />
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to this page *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/features/update' feature_id=$feature_id}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='feature_id'}
|
||||
<input type="hidden" name="{$name}" value="{$feature_id}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
|
||||
{loop type="lang" name="current-edit-lang" id="$edit_language_id"}
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Feature title'}" placeholder="{intl l='Title'}">
|
||||
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
|
||||
</div>
|
||||
|
||||
<div class="help-block">{intl l="Enter here the value in the current edit language ($TITLE)"}</div>
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
||||
{/form_field}
|
||||
{/loop}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='feature_value_create_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "creation_dialog"
|
||||
dialog_title = {intl l="Create a new feature value"}
|
||||
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create this value"}
|
||||
|
||||
form_action = {url path='/admin/configuration/features-av/create'}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
{/form}
|
||||
|
||||
{* Delete value confirmation dialog *}
|
||||
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="feature_id" value="{$feature_id}" />
|
||||
<input type="hidden" name="featureav_id" id="value_delete_id" value="" />
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "delete_dialog"
|
||||
dialog_title = {intl l="Delete feature value"}
|
||||
dialog_message = {intl l="Do you really want to delete this feature value ?"}
|
||||
|
||||
form_action = {url path='/admin/configuration/features-av/delete'}
|
||||
form_content = {$smarty.capture.delete_dialog nofilter}
|
||||
}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
{javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
// Set proper feature ID in delete from
|
||||
$('a.value-delete').click(function(ev) {
|
||||
$('#value_delete_id').val($(this).data('id'));
|
||||
});
|
||||
|
||||
// JS stuff for creation form
|
||||
{include
|
||||
file = "includes/generic-js-dialog.html"
|
||||
dialog_id = "creation_dialog"
|
||||
form_name = "thelia.admin.featureav.creation"
|
||||
}
|
||||
|
||||
{* Inline editing of object position using bootstrap-editable *}
|
||||
|
||||
$('.positionChange').editable({
|
||||
type : 'text',
|
||||
title : '{intl l="Enter new value position"}',
|
||||
mode : 'popup',
|
||||
inputclass : 'input-mini',
|
||||
placement : 'left',
|
||||
success : function(response, newValue) {
|
||||
// The URL template
|
||||
var url = "{url path='/admin/configuration/features-av/update-position' featureav_id='__ID__' position='__POS__' feature_id=$feature_id}";
|
||||
|
||||
// Perform subtitutions
|
||||
url = url.replace('__ID__', $(this).data('id')).replace('__POS__', newValue);
|
||||
|
||||
// Reload the page
|
||||
location.href = url;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
326
templates/admin/default/features.html
Normal file
326
templates/admin/default/features.html
Normal file
@@ -0,0 +1,326 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="page-title"}{intl l='Thelia Product Features'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.features.view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="features">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration/features'}">{intl l="Product features"}</a></li>
|
||||
</ul>
|
||||
|
||||
{module_include location='features_top'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<form action="#" method="post">
|
||||
<div class="general-block-decorator">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption>
|
||||
{intl l='Thelia product features'}
|
||||
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.features.create"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new product feature'}" href="#creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
{admin_sortable_header
|
||||
current_order=$order
|
||||
order='id'
|
||||
reverse_order='id_reverse'
|
||||
path='/admin/configuration/features'
|
||||
label="{intl l='ID'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th>
|
||||
{admin_sortable_header
|
||||
current_order=$order
|
||||
order='alpha'
|
||||
reverse_order='alpha_reverse'
|
||||
path='/admin/configuration/features'
|
||||
label="{intl l='Title'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th class="text-center">
|
||||
{admin_sortable_header
|
||||
current_order=$order
|
||||
order='manual'
|
||||
reverse_order='manual_reverse'
|
||||
path='/admin/configuration/features'
|
||||
label="{intl l="Position"}"
|
||||
}
|
||||
</th>
|
||||
|
||||
{module_include location='features_table_header'}
|
||||
|
||||
<th class="actions">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="list" type="feature" backend_context="1" lang=$lang_id order=$order}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
|
||||
<td>
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.features.change"}
|
||||
<a title="{intl l='Change this feature'}" href="{url path='/admin/configuration/features/update' feature_id=$ID}">{$TITLE}</a>
|
||||
{/loop}
|
||||
{elseloop rel="can_change"}
|
||||
{$TITLE}
|
||||
{/elseloop}
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
permission="admin.features.edit"
|
||||
path="/admin/configuration/features/update-position"
|
||||
url_parameter="feature_id"
|
||||
in_place_edit_class="positionChange"
|
||||
position="$POSITION"
|
||||
id="$ID"
|
||||
}
|
||||
</td>
|
||||
|
||||
{module_include location='features_table_row'}
|
||||
|
||||
<td class="actions">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.features.change"}
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-default btn-xs feature-remove-from-all" title="{intl l='Remove this feature from all product templates'}" href="#remove_from_all_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-minus"></span>
|
||||
</a>
|
||||
<a class="btn btn-default btn-xs feature-add-to-all" title="{intl l='Add this feature to all product templates'}" href="#add_to_all_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
</a>
|
||||
</div>
|
||||
{/loop}
|
||||
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.features.change"}
|
||||
<a class="btn btn-default btn-xs feature-change" title="{intl l='Change this product feature'}" href="{url path='/admin/configuration/features/update' feature_id=$ID}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.features.delete"}
|
||||
<a class="btn btn-default btn-xs feature-delete" title="{intl l='Delete this product feature'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="list"}
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="alert alert-info">
|
||||
{intl l="No product feature has been created yet. Click the + button to create one."}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{module_include location='features_bottom'}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* Adding a new feature *}
|
||||
|
||||
{form name="thelia.admin.feature.creation"}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "creation_dialog"}
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to the edition page, _ID_ is replaced with the created feature ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/features/update' feature_id='_ID_'}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
|
||||
{loop type="lang" name="default-lang" default_only="1"}
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Feature title'}" placeholder="{intl l='Title'}">
|
||||
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
|
||||
</div>
|
||||
|
||||
<div class="help-block">{intl l="Enter here the feature name in the default language ($TITLE)"}</div>
|
||||
|
||||
{* Switch edition to the current locale *}
|
||||
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
||||
{/form_field}
|
||||
{/loop}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='add_to_all'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<div class="checkbox {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">
|
||||
<input type="checkbox" name="{$name}" value="1" {if $value != 0}checked="checked"{/if}>
|
||||
{$label}
|
||||
</label>
|
||||
<span class="help-block">{intl l='Check this box if you want to add this features to all product templates'}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='feature_create_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "creation_dialog"
|
||||
dialog_title = {intl l="Create a new feature"}
|
||||
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create this feature"}
|
||||
|
||||
form_action = {url path='/admin/configuration/features/create'}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
{/form}
|
||||
|
||||
{* Delete confirmation dialog *}
|
||||
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="feature_id" id="feature_delete_id" value="" />
|
||||
|
||||
{module_include location='feature_delete_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "delete_dialog"
|
||||
dialog_title = {intl l="Delete feature"}
|
||||
dialog_message = {intl l="Do you really want to delete this feature ? It will be removed from all product templates."}
|
||||
|
||||
form_action = {url path='/admin/configuration/features/delete'}
|
||||
form_content = {$smarty.capture.delete_dialog nofilter}
|
||||
}
|
||||
|
||||
|
||||
{* Add to all dialog *}
|
||||
|
||||
{capture "add_to_all_dialog"}
|
||||
<input type="hidden" name="feature_id" id="feature_add_to_all_id" value="" />
|
||||
|
||||
{module_include location='feature_add_to_all_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "add_to_all_dialog"
|
||||
dialog_title = {intl l="Add to all product templates"}
|
||||
dialog_message = {intl l="Do you really want to add this feature to all product templates ?"}
|
||||
|
||||
form_action = {url path='/admin/configuration/features/add-to-all-templates'}
|
||||
form_content = {$smarty.capture.add_to_all_dialog nofilter}
|
||||
}
|
||||
|
||||
{* Remove from all dialog *}
|
||||
|
||||
{capture "remove_from_all_dialog"}
|
||||
<input type="hidden" name="feature_id" id="feature_remove_from_all_id" value="" />
|
||||
|
||||
{module_include location='feature_add_to_all_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "remove_from_all_dialog"
|
||||
dialog_title = {intl l="Remove from all product templates"}
|
||||
dialog_message = {intl l="Do you really want to remove this feature from all product templates ? You'll loose all product related data for this feature."}
|
||||
|
||||
form_action = {url path='/admin/configuration/features/remove-from-all-templates'}
|
||||
form_content = {$smarty.capture.remove_from_all_dialog nofilter}
|
||||
}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
{javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
// Set proper feature ID in delete from
|
||||
$('a.feature-delete').click(function(ev) {
|
||||
$('#feature_delete_id').val($(this).data('id'));
|
||||
});
|
||||
|
||||
$('a.feature-add-to-all').click(function(ev) {
|
||||
$('#feature_add_to_all_id').val($(this).data('id'));
|
||||
});
|
||||
|
||||
$('a.feature-remove-from-all').click(function(ev) {
|
||||
$('#feature_remove_from_all_id').val($(this).data('id'));
|
||||
});
|
||||
|
||||
// JS stuff for creation form
|
||||
{include
|
||||
file = "includes/generic-js-dialog.html"
|
||||
dialog_id = "creation_dialog"
|
||||
form_name = "thelia.admin.feature.creation"
|
||||
}
|
||||
|
||||
{* Inline editing of object position using bootstrap-editable *}
|
||||
|
||||
$('.positionChange').editable({
|
||||
type : 'text',
|
||||
title : '{intl l="Enter new feature position"}',
|
||||
mode : 'popup',
|
||||
inputclass : 'input-mini',
|
||||
placement : 'left',
|
||||
success : function(response, newValue) {
|
||||
// The URL template
|
||||
var url = "{url path='/admin/configuration/features/update-position' feature_id='__ID__' position='__POS__'}";
|
||||
|
||||
// Perform subtitutions
|
||||
url = url.replace('__ID__', $(this).data('id'))
|
||||
.replace('__POS__', newValue);
|
||||
|
||||
// Reload the page
|
||||
location.href = url;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
@@ -1,5 +0,0 @@
|
||||
{* Breadcrumb for coupon browsing and editing *}
|
||||
|
||||
<li><a href="{url path='admin/home'}">Home</a></li>
|
||||
<li><a href="{url path='admin/coupon'}">Coupon</a></li>
|
||||
<li><a href="{url path="admin/coupon/browse/$ID"}">Browse</a></li>
|
||||
Reference in New Issue
Block a user