mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
revert real usage of templateUrl
This commit is contained in:
parent
9b6e5408f9
commit
31d1071f87
@ -58,8 +58,8 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
prefix: settings.invoice_prefix,
|
||||
nextId: 40,
|
||||
date: moment().format('DDMMYYYY'),
|
||||
template: require('../../../../templates/editPrefix.html')
|
||||
}
|
||||
templateUrl: 'editPrefix.html'
|
||||
};
|
||||
|
||||
// Invoices parameters
|
||||
$scope.invoice = {
|
||||
@ -67,22 +67,22 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
reference: {
|
||||
model: '',
|
||||
help: null,
|
||||
template: require('../../../../templates/editReference.html')
|
||||
templateUrl: 'editReference.html'
|
||||
},
|
||||
code: {
|
||||
model: '',
|
||||
active: true,
|
||||
template: require('../../../../templates/editCode.html')
|
||||
templateUrl: 'editCode.html'
|
||||
},
|
||||
number: {
|
||||
model: '',
|
||||
help: null,
|
||||
template: require('../../../../templates/editNumber.html')
|
||||
templateUrl: 'editNumber.html'
|
||||
},
|
||||
VAT: {
|
||||
rate: 19.6,
|
||||
active: false,
|
||||
template: require('../../../../templates/editVAT.html')
|
||||
templateUrl: 'editVAT.html'
|
||||
},
|
||||
text: {
|
||||
content: ''
|
||||
@ -96,87 +96,87 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
$scope.settings = {
|
||||
journalCode: {
|
||||
name: 'accounting_journal_code',
|
||||
value: settings['accounting_journal_code']
|
||||
value: settings.accounting_journal_code
|
||||
},
|
||||
cardClientCode: {
|
||||
name: 'accounting_card_client_code',
|
||||
value: settings['accounting_card_client_code']
|
||||
value: settings.accounting_card_client_code
|
||||
},
|
||||
cardClientLabel: {
|
||||
name: 'accounting_card_client_label',
|
||||
value: settings['accounting_card_client_label']
|
||||
value: settings.accounting_card_client_label
|
||||
},
|
||||
walletClientCode: {
|
||||
name: 'accounting_wallet_client_code',
|
||||
value: settings['accounting_wallet_client_code']
|
||||
value: settings.accounting_wallet_client_code
|
||||
},
|
||||
walletClientLabel: {
|
||||
name: 'accounting_wallet_client_label',
|
||||
value: settings['accounting_wallet_client_label']
|
||||
value: settings.accounting_wallet_client_label
|
||||
},
|
||||
otherClientCode: {
|
||||
name: 'accounting_other_client_code',
|
||||
value: settings['accounting_other_client_code']
|
||||
value: settings.accounting_other_client_code
|
||||
},
|
||||
otherClientLabel: {
|
||||
name: 'accounting_other_client_label',
|
||||
value: settings['accounting_other_client_label']
|
||||
value: settings.accounting_other_client_label
|
||||
},
|
||||
walletCode: {
|
||||
name: 'accounting_wallet_code',
|
||||
value: settings['accounting_wallet_code']
|
||||
value: settings.accounting_wallet_code
|
||||
},
|
||||
walletLabel: {
|
||||
name: 'accounting_wallet_label',
|
||||
value: settings['accounting_wallet_label']
|
||||
value: settings.accounting_wallet_label
|
||||
},
|
||||
vatCode: {
|
||||
name: 'accounting_VAT_code',
|
||||
value: settings['accounting_VAT_code']
|
||||
value: settings.accounting_VAT_code
|
||||
},
|
||||
vatLabel: {
|
||||
name: 'accounting_VAT_label',
|
||||
value: settings['accounting_VAT_label']
|
||||
value: settings.accounting_VAT_label
|
||||
},
|
||||
subscriptionCode: {
|
||||
name: 'accounting_subscription_code',
|
||||
value: settings['accounting_subscription_code']
|
||||
value: settings.accounting_subscription_code
|
||||
},
|
||||
subscriptionLabel: {
|
||||
name: 'accounting_subscription_label',
|
||||
value: settings['accounting_subscription_label']
|
||||
value: settings.accounting_subscription_label
|
||||
},
|
||||
machineCode: {
|
||||
name: 'accounting_Machine_code',
|
||||
value: settings['accounting_Machine_code']
|
||||
value: settings.accounting_Machine_code
|
||||
},
|
||||
machineLabel: {
|
||||
name: 'accounting_Machine_label',
|
||||
value: settings['accounting_Machine_label']
|
||||
value: settings.accounting_Machine_label
|
||||
},
|
||||
trainingCode: {
|
||||
name: 'accounting_Training_code',
|
||||
value: settings['accounting_Training_code']
|
||||
value: settings.accounting_Training_code
|
||||
},
|
||||
trainingLabel: {
|
||||
name: 'accounting_Training_label',
|
||||
value: settings['accounting_Training_label']
|
||||
value: settings.accounting_Training_label
|
||||
},
|
||||
eventCode: {
|
||||
name: 'accounting_Event_code',
|
||||
value: settings['accounting_Event_code']
|
||||
value: settings.accounting_Event_code
|
||||
},
|
||||
eventLabel: {
|
||||
name: 'accounting_Event_label',
|
||||
value: settings['accounting_Event_label']
|
||||
value: settings.accounting_Event_label
|
||||
},
|
||||
spaceCode: {
|
||||
name: 'accounting_Space_code',
|
||||
value: settings['accounting_Space_code']
|
||||
value: settings.accounting_Space_code
|
||||
},
|
||||
spaceLabel: {
|
||||
name: 'accounting_Space_label',
|
||||
value: settings['accounting_Space_label']
|
||||
value: settings.accounting_Space_label
|
||||
}
|
||||
};
|
||||
|
||||
@ -224,8 +224,8 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
controller: 'AvoirModalController',
|
||||
resolve: {
|
||||
invoice () { return invoice; },
|
||||
closedPeriods() { return AccountingPeriod.query().$promise; },
|
||||
lastClosingEnd() { return AccountingPeriod.lastClosingEnd().$promise; }
|
||||
closedPeriods () { return AccountingPeriod.query().$promise; },
|
||||
lastClosingEnd () { return AccountingPeriod.lastClosingEnd().$promise; }
|
||||
}
|
||||
});
|
||||
|
||||
@ -440,15 +440,14 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
$scope.ok = function () { $uibModalInstance.close({ rate: $scope.rate, active: $scope.isSelected }); };
|
||||
$scope.cancel = function () { $uibModalInstance.dismiss('cancel'); };
|
||||
|
||||
|
||||
const initialize = function() {
|
||||
const initialize = function () {
|
||||
rateHistory.setting.history.forEach(function (rate) {
|
||||
$scope.history.push({ date: rate.created_at, rate: rate.value, user: rate.user })
|
||||
$scope.history.push({ date: rate.created_at, rate: rate.value, user: rate.user });
|
||||
});
|
||||
activeHistory.setting.history.forEach(function (v) {
|
||||
$scope.history.push({ date: v.created_at, enabled: v.value === 'true', user: v.user })
|
||||
$scope.history.push({ date: v.created_at, enabled: v.value === 'true', user: v.user });
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
initialize();
|
||||
}]
|
||||
@ -494,7 +493,7 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
templateUrl: $scope.file.templateUrl,
|
||||
size: 'lg',
|
||||
resolve: {
|
||||
model () { return $scope.file.prefix;}
|
||||
model () { return $scope.file.prefix; }
|
||||
},
|
||||
controller: ['$scope', '$uibModalInstance', 'model', function ($scope, $uibModalInstance, model) {
|
||||
$scope.model = model;
|
||||
@ -557,7 +556,7 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
*/
|
||||
$scope.handleFilterChange = function () {
|
||||
if (searchTimeout) clearTimeout(searchTimeout);
|
||||
searchTimeout = setTimeout(function() {
|
||||
searchTimeout = setTimeout(function () {
|
||||
resetSearchInvoice();
|
||||
invoiceSearch();
|
||||
}, 300);
|
||||
@ -576,7 +575,7 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
* Open a modal allowing the user to close an accounting period and to
|
||||
* view all periods already closed.
|
||||
*/
|
||||
$scope.closeAnAccountingPeriod = function() {
|
||||
$scope.closeAnAccountingPeriod = function () {
|
||||
// open modal
|
||||
$uibModal.open({
|
||||
template: require('../../../../templates/admin/invoices/closePeriodModal.html'),
|
||||
@ -585,38 +584,38 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
keyboard: false,
|
||||
size: 'lg',
|
||||
resolve: {
|
||||
periods() { return AccountingPeriod.query().$promise; },
|
||||
lastClosingEnd() { return AccountingPeriod.lastClosingEnd().$promise; }
|
||||
periods () { return AccountingPeriod.query().$promise; },
|
||||
lastClosingEnd () { return AccountingPeriod.lastClosingEnd().$promise; }
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.toggleExportModal = function() {
|
||||
$scope.toggleExportModal = function () {
|
||||
$uibModal.open({
|
||||
template: require('../../../../templates/admin/invoices/accountingExportModal.html'),
|
||||
controller: 'AccountingExportModalController',
|
||||
size: 'xl'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Test if the given date is within a closed accounting period
|
||||
* @param date {Date} date to test
|
||||
* @returns {boolean} true if closed, false otherwise
|
||||
*/
|
||||
$scope.isDateClosed = function(date) {
|
||||
$scope.isDateClosed = function (date) {
|
||||
for (const period of closedPeriods) {
|
||||
if (moment(date).isBetween(moment.utc(period.start_at).startOf('day'), moment.utc(period.end_at).endOf('day'), null, '[]')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Callback to bulk save all settings in the page to the database with their values
|
||||
*/
|
||||
$scope.save = function() {
|
||||
$scope.save = function () {
|
||||
Setting.bulkUpdate(
|
||||
{ settings: Object.values($scope.settings) },
|
||||
function () { growl.success(_t('app.admin.invoices.codes_customization_success')); },
|
||||
@ -625,29 +624,29 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
console.error(error);
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the name of the operator that creates the invoice
|
||||
*/
|
||||
$scope.operatorName = function(invoice) {
|
||||
$scope.operatorName = function (invoice) {
|
||||
if (!invoice.operator) return '';
|
||||
|
||||
return `${invoice.operator.first_name} ${invoice.operator.last_name}`;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Open a modal dialog which ask for the stripe keys
|
||||
* @param onlinePaymentModule {{name: String, value: String}} setting that defines the next status of the online payment module
|
||||
* @return {boolean} false if the keys were not provided
|
||||
*/
|
||||
$scope.requireStripeKeys = function(onlinePaymentModule) {
|
||||
$scope.requireStripeKeys = function (onlinePaymentModule) {
|
||||
// if the online payment is about to be disabled, accept the change without any further question
|
||||
if (onlinePaymentModule.value === false) return true;
|
||||
|
||||
// otherwise, open a modal to ask for the stripe keys
|
||||
const modalInstance = $uibModal.open({
|
||||
template: require('../../../../templates/stripeKeys.html'),
|
||||
templateUrl: 'stripeKeys.html',
|
||||
controller: 'StripeKeysModalController',
|
||||
resolve: {
|
||||
stripeKeys: ['Setting', function (Setting) { return Setting.query({ names: "['stripe_public_key', 'stripe_secret_key']" }).$promise; }]
|
||||
@ -658,19 +657,19 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
if (success) {
|
||||
Setting.get({ name: 'stripe_public_key' }, function (res) {
|
||||
$scope.allSettings.stripe_public_key = res.setting.value;
|
||||
})
|
||||
});
|
||||
Setting.isPresent({ name: 'stripe_secret_key' }, function (res) {
|
||||
$scope.stripeSecretKey = (res.isPresent ? STRIPE_SK_HIDDEN : '');
|
||||
})
|
||||
});
|
||||
Payment.onlinePaymentStatus(function (res) {
|
||||
$scope.onlinePaymentStatus = res.status;
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// return the promise
|
||||
return modalInstance.result;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Setup the feature-tour for the admin/invoices page.
|
||||
@ -814,7 +813,7 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
if (settings.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('invoices') < 0) {
|
||||
uitour.start();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* PRIVATE SCOPE */
|
||||
|
||||
@ -827,18 +826,18 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
}
|
||||
|
||||
// retrieve settings from the DB through the API
|
||||
$scope.invoice.legals.content = settings['invoice_legals'];
|
||||
$scope.invoice.text.content = settings['invoice_text'];
|
||||
$scope.invoice.legals.content = settings.invoice_legals;
|
||||
$scope.invoice.text.content = settings.invoice_text;
|
||||
$scope.invoice.VAT.rate = parseFloat(settings['invoice_VAT-rate']);
|
||||
$scope.invoice.VAT.active = (settings['invoice_VAT-active'] === 'true');
|
||||
$scope.invoice.number.model = settings['invoice_order-nb'];
|
||||
$scope.invoice.code.model = settings['invoice_code-value'];
|
||||
$scope.invoice.code.active = (settings['invoice_code-active'] === 'true');
|
||||
$scope.invoice.reference.model = settings['invoice_reference'];
|
||||
$scope.invoice.reference.model = settings.invoice_reference;
|
||||
$scope.invoice.logo = {
|
||||
filetype: 'image/png',
|
||||
filename: 'logo.png',
|
||||
base64: settings['invoice_logo']
|
||||
base64: settings.invoice_logo
|
||||
};
|
||||
|
||||
// Watch the logo, when a change occurs, save it
|
||||
@ -990,7 +989,7 @@ Application.Controllers.controller('AvoirModalController', ['$scope', '$uibModal
|
||||
$scope.ok = function () {
|
||||
// check that at least 1 element of the invoice is refunded
|
||||
$scope.avoir.invoice_items_ids = [];
|
||||
for (let itemId in $scope.partial) {
|
||||
for (const itemId in $scope.partial) {
|
||||
if (Object.prototype.hasOwnProperty.call($scope.partial, itemId)) {
|
||||
const refundItem = $scope.partial[itemId];
|
||||
if (refundItem) {
|
||||
@ -1024,14 +1023,14 @@ Application.Controllers.controller('AvoirModalController', ['$scope', '$uibModal
|
||||
* @param date {Date} date to test
|
||||
* @returns {boolean} true if closed, false otherwise
|
||||
*/
|
||||
$scope.isDateClosed = function(date) {
|
||||
$scope.isDateClosed = function (date) {
|
||||
for (const period of closedPeriods) {
|
||||
if (moment(date).isBetween(moment.utc(period.start_at).startOf('day'), moment.utc(period.end_at).endOf('day'), null, '[]')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/* PRIVATE SCOPE */
|
||||
|
||||
@ -1058,11 +1057,10 @@ Application.Controllers.controller('AvoirModalController', ['$scope', '$uibModal
|
||||
}
|
||||
]);
|
||||
|
||||
|
||||
/**
|
||||
* Controller used in the modal window allowing an admin to close an accounting period
|
||||
*/
|
||||
Application.Controllers.controller('ClosePeriodModalController', ['$scope', '$uibModalInstance', '$window', '$sce', 'Invoice', 'AccountingPeriod', 'periods', 'lastClosingEnd','dialogs', 'growl', '_t',
|
||||
Application.Controllers.controller('ClosePeriodModalController', ['$scope', '$uibModalInstance', '$window', '$sce', 'Invoice', 'AccountingPeriod', 'periods', 'lastClosingEnd', 'dialogs', 'growl', '_t',
|
||||
function ($scope, $uibModalInstance, $window, $sce, Invoice, AccountingPeriod, periods, lastClosingEnd, dialogs, growl, _t) {
|
||||
const YESTERDAY = moment.utc({ h: 0, m: 0, s: 0, ms: 0 }).subtract(1, 'day').toDate();
|
||||
const LAST_CLOSING = moment.utc(lastClosingEnd.last_end_date).toDate();
|
||||
@ -1124,11 +1122,11 @@ Application.Controllers.controller('ClosePeriodModalController', ['$scope', '$ui
|
||||
_t(
|
||||
'app.admin.invoices.confirm_close_START_END',
|
||||
{ START: moment.utc($scope.period.start_at).format('LL'), END: moment.utc($scope.period.end_at).format('LL') }
|
||||
)
|
||||
+ '<br/><br/><strong>'
|
||||
+ _t('app.admin.invoices.period_must_match_fiscal_year')
|
||||
+ '</strong><br/><br/>'
|
||||
+ _t('app.admin.invoices.this_may_take_a_while')
|
||||
) +
|
||||
'<br/><br/><strong>' +
|
||||
_t('app.admin.invoices.period_must_match_fiscal_year') +
|
||||
'</strong><br/><br/>' +
|
||||
_t('app.admin.invoices.this_may_take_a_while')
|
||||
)
|
||||
};
|
||||
}
|
||||
@ -1151,7 +1149,7 @@ Application.Controllers.controller('ClosePeriodModalController', ['$scope', '$ui
|
||||
));
|
||||
$uibModalInstance.close(resp);
|
||||
},
|
||||
function(error) {
|
||||
function (error) {
|
||||
$scope.pendingCreation = false;
|
||||
growl.error(_t('app.admin.invoices.failed_to_close_period'));
|
||||
$scope.errors = error.data;
|
||||
@ -1159,7 +1157,6 @@ Application.Controllers.controller('ClosePeriodModalController', ['$scope', '$ui
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1170,9 +1167,9 @@ Application.Controllers.controller('ClosePeriodModalController', ['$scope', '$ui
|
||||
/**
|
||||
* Trigger the API call to download the JSON archive of the closed accounting period
|
||||
*/
|
||||
$scope.downloadArchive = function(period) {
|
||||
$scope.downloadArchive = function (period) {
|
||||
$window.location.href = `/api/accounting_periods/${period.id}/archive`;
|
||||
}
|
||||
};
|
||||
}
|
||||
]);
|
||||
|
||||
@ -1251,7 +1248,7 @@ Application.Controllers.controller('AccountingExportModalController', ['$scope',
|
||||
* @param event {Object} see https://docs.angularjs.org/guide/expression#-event-
|
||||
* @param picker {string} start | end
|
||||
*/
|
||||
$scope.toggleDatePicker = function(event, picker) {
|
||||
$scope.toggleDatePicker = function (event, picker) {
|
||||
event.preventDefault();
|
||||
$scope.datePicker.opened[picker] = !$scope.datePicker.opened[picker];
|
||||
};
|
||||
@ -1260,7 +1257,7 @@ Application.Controllers.controller('AccountingExportModalController', ['$scope',
|
||||
* Will fill the export settings, according to the selected software
|
||||
* @param software {String} must be one of SETTINGS.*
|
||||
*/
|
||||
$scope.fillSettings = function(software) {
|
||||
$scope.fillSettings = function (software) {
|
||||
$scope.exportTarget.settings = SETTINGS[software];
|
||||
};
|
||||
|
||||
@ -1287,7 +1284,7 @@ Application.Controllers.controller('AccountingExportModalController', ['$scope',
|
||||
* Prepare the query for the export API
|
||||
* @returns {{extension: *, query: *, category: string, type: *, key: *}}
|
||||
*/
|
||||
const mkQuery = function() {
|
||||
const mkQuery = function () {
|
||||
return {
|
||||
category: 'accounting',
|
||||
type: $scope.exportTarget.software,
|
||||
@ -1304,13 +1301,11 @@ Application.Controllers.controller('AccountingExportModalController', ['$scope',
|
||||
export_invoices_at_zero: $scope.exportTarget.settings.exportInvoicesAtZero
|
||||
})
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// !!! MUST BE CALLED AT THE END of the controller
|
||||
return initialize();
|
||||
}]);
|
||||
|
||||
|
||||
}]);
|
||||
|
||||
/**
|
||||
* Controller used in the modal window allowing an admin to close an accounting period
|
||||
@ -1343,15 +1338,14 @@ Application.Controllers.controller('StripeKeysModalController', ['$scope', '$uib
|
||||
method: 'GET',
|
||||
url: 'https://api.stripe.com/v1/charges',
|
||||
headers: {
|
||||
Authorization: `Bearer ${$scope.secretKey}`,
|
||||
Authorization: `Bearer ${$scope.secretKey}`
|
||||
}
|
||||
}).then(function () {
|
||||
$scope.secretKeyStatus = true;
|
||||
}, function (err) {
|
||||
if (err.status === 401) $scope.secretKeyStatus = false;
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Trigger the test of the secret key and set the result in $scope.secretKeyStatus
|
||||
@ -1370,14 +1364,14 @@ Application.Controllers.controller('StripeKeysModalController', ['$scope', '$uib
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: $httpParamSerializerJQLike({
|
||||
'pii[id_number]': 'test',
|
||||
'pii[id_number]': 'test'
|
||||
})
|
||||
}).then(function () {
|
||||
$scope.publicKeyStatus = true;
|
||||
}, function (err) {
|
||||
if (err.status === 401) $scope.publicKeyStatus = false;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Validate the keys
|
||||
@ -1385,7 +1379,8 @@ Application.Controllers.controller('StripeKeysModalController', ['$scope', '$uib
|
||||
$scope.ok = function () {
|
||||
if ($scope.secretKeyStatus && $scope.publicKeyStatus) {
|
||||
Setting.bulkUpdate(
|
||||
{ settings: [
|
||||
{
|
||||
settings: [
|
||||
{
|
||||
name: 'stripe_public_key',
|
||||
value: $scope.publicKey
|
||||
@ -1394,7 +1389,8 @@ Application.Controllers.controller('StripeKeysModalController', ['$scope', '$uib
|
||||
name: 'stripe_secret_key',
|
||||
value: $scope.secretKey
|
||||
}
|
||||
] },
|
||||
]
|
||||
},
|
||||
function () {
|
||||
growl.success(_t('app.admin.invoices.payment.stripe_keys_saved'));
|
||||
$uibModalInstance.close(true);
|
||||
@ -1405,7 +1401,7 @@ Application.Controllers.controller('StripeKeysModalController', ['$scope', '$uib
|
||||
}
|
||||
);
|
||||
} else {
|
||||
growl.error(_t('app.admin.invoices.payment.error_check_keys'))
|
||||
growl.error(_t('app.admin.invoices.payment.error_check_keys'));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -84,7 +84,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
|
||||
$scope.calendarStyle = function (calendar) {
|
||||
return {
|
||||
'border-color': calendar.color,
|
||||
'color': calendar.text_color
|
||||
color: calendar.text_color
|
||||
};
|
||||
};
|
||||
|
||||
@ -106,7 +106,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
|
||||
|
||||
$scope.openFilterAside = () =>
|
||||
$aside.open({
|
||||
template: require('../../../templates/filterAside.html'),
|
||||
templateUrl: 'filterAside.html',
|
||||
placement: 'right',
|
||||
size: 'md',
|
||||
backdrop: false,
|
||||
@ -148,8 +148,8 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
|
||||
$uibModalInstance.dismiss();
|
||||
return e.stopPropagation();
|
||||
};
|
||||
}
|
||||
] });
|
||||
}]
|
||||
});
|
||||
|
||||
/* PRIVATE SCOPE */
|
||||
|
||||
@ -175,7 +175,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
|
||||
viewRender (view, element) {
|
||||
return viewRenderCb(view, element);
|
||||
},
|
||||
eventRender (event, element, view) {
|
||||
eventRender (event, element) {
|
||||
return eventRenderCb(event, element);
|
||||
}
|
||||
});
|
||||
@ -194,7 +194,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
|
||||
/**
|
||||
* Callback triggered when an event object is clicked in the fullCalendar view
|
||||
*/
|
||||
const calendarEventClickCb = function (event, jsEvent, view) {
|
||||
const calendarEventClickCb = function (event) {
|
||||
// current calendar object
|
||||
const { calendar } = uiCalendarConfig.calendars;
|
||||
if (event.available_type === 'machines') {
|
||||
@ -240,7 +240,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
|
||||
* This function is called when calendar view is rendered or changed
|
||||
* @see https://fullcalendar.io/docs/v3/viewRender#v2
|
||||
*/
|
||||
const viewRenderCb = function (view, element) {
|
||||
const viewRenderCb = function (view) {
|
||||
toggleSlotEventOverlap(view);
|
||||
if (view.type === 'agendaDay') {
|
||||
// get availabilties by 1 day for show machine slots
|
||||
@ -255,7 +255,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
|
||||
const eventRenderCb = function (event, element) {
|
||||
if (event.tags && event.tags.length > 0) {
|
||||
let html = '';
|
||||
for (let tag of Array.from(event.tags)) {
|
||||
for (const tag of Array.from(event.tags)) {
|
||||
html += `<span class='label label-success text-white'>${tag.name}</span> `;
|
||||
}
|
||||
element.find('.fc-title').append(`<br/>${html}`);
|
||||
@ -269,7 +269,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
|
||||
return { t, m, s, evt: $scope.filter.evt, dispo: $scope.filter.dispo };
|
||||
};
|
||||
|
||||
var availabilitySourceUrl = () => `/api/availabilities/public?${$.param(getFilter())}`;
|
||||
const availabilitySourceUrl = () => `/api/availabilities/public?${$.param(getFilter())}`;
|
||||
|
||||
// !!! MUST BE CALLED AT THE END of the controller
|
||||
return initialize();
|
||||
|
@ -29,22 +29,22 @@ Application.Directives.directive('selectMultipleSetting', ['Setting', 'growl', '
|
||||
/**
|
||||
* Remove the items in the selection from the options and update setting.value
|
||||
*/
|
||||
$scope.removeItem = function() {
|
||||
$scope.removeItem = function () {
|
||||
const options = $scope.options.filter(function (opt) {
|
||||
return $scope.selection.indexOf(opt) < 0;
|
||||
})
|
||||
});
|
||||
$scope.options = options;
|
||||
$scope.setting.value = options.join(' ');
|
||||
growl.success(_t('app.admin.settings.COUNT_items_removed', { COUNT: $scope.selection.length }));
|
||||
$scope.selection = [];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Open a modal dialog asking for the value of a new item to add
|
||||
*/
|
||||
$scope.addItem = function() {
|
||||
$scope.addItem = function () {
|
||||
$uibModal.open({
|
||||
template: require('../../../../templates/newSelectOption.html'),
|
||||
templateUrl: 'newSelectOption.html',
|
||||
resolve: {
|
||||
titleNew: function () { return $scope.titleNew; },
|
||||
descriptionNew: function () { return $scope.descriptionNew; }
|
||||
@ -60,7 +60,7 @@ Application.Directives.directive('selectMultipleSetting', ['Setting', 'growl', '
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
}
|
||||
}).result['finally'](null).then(function(val) {
|
||||
}).result.finally(null).then(function (val) {
|
||||
const options = Array.from($scope.options);
|
||||
if (typeof $scope.beforeAdd === 'function') { val = $scope.beforeAdd(val); }
|
||||
options.push(val);
|
||||
@ -68,14 +68,14 @@ Application.Directives.directive('selectMultipleSetting', ['Setting', 'growl', '
|
||||
$scope.setting.value = options.join(' ');
|
||||
growl.success(_t('app.admin.settings.item_added'));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Callback to save the setting value to the database
|
||||
* @param setting {{value:*, name:string}} note that the value will be stringified
|
||||
*/
|
||||
$scope.save = function (setting) {
|
||||
let { value } = setting;
|
||||
const { value } = setting;
|
||||
|
||||
Setting.update(
|
||||
{ name: setting.name },
|
||||
|
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
// TODO remove unused?
|
||||
(function (angular) {
|
||||
var deviseModal = angular.module('DeviseModal', [
|
||||
const deviseModal = angular.module('DeviseModal', [
|
||||
'Devise',
|
||||
'ui.bootstrap'
|
||||
]);
|
||||
@ -12,25 +12,25 @@
|
||||
'$rootScope',
|
||||
function ($uibModal, $http, Auth, $rootScope) {
|
||||
var promise = null;
|
||||
function reset() {
|
||||
function reset () {
|
||||
promise = null;
|
||||
}
|
||||
function partial(fn, arg) {
|
||||
function partial (fn, arg) {
|
||||
return function () {
|
||||
return fn.call(this, arg);
|
||||
};
|
||||
}
|
||||
$rootScope.$on('devise:unauthorized', function (event, response, deferred) {
|
||||
function retryRequestAfterLogin() {
|
||||
function retryRequestAfterLogin () {
|
||||
return promise.then(function () {
|
||||
return $http(response.config);
|
||||
}).then(deferred.resolve, partial(deferred.reject, response));
|
||||
}
|
||||
if (!promise) {
|
||||
promise = $uibModal.open({
|
||||
template: require('../../../templates/deviseModal.html'),
|
||||
templateUrl: 'deviseModal.html',
|
||||
controller: function ($scope, $uibModalInstance) {
|
||||
var user = $scope.user = {};
|
||||
const user = $scope.user = {};
|
||||
$scope.login = function () {
|
||||
$uibModalInstance.close(user);
|
||||
};
|
||||
@ -38,7 +38,7 @@
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
}
|
||||
}).result['finally'](reset).then(Auth.login);
|
||||
}).result.finally(reset).then(Auth.login);
|
||||
}
|
||||
retryRequestAfterLogin();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user