1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

Ability to configure the prefix of the payment-schedules' files

This commit is contained in:
Sylvain 2021-06-10 12:04:00 +02:00
parent 71775378e8
commit 854db568bf
8 changed files with 106 additions and 1 deletions

View File

@ -16,6 +16,7 @@
- Validate on server side the reservation of slots restricted to subscribers
Unified and documented upgrade exit codes
- During setup, ask for the name of the external network and create it, if it does not already exists
- Ability to configure the prefix of the payment-schedules' files
- Fix a bug: cannot select the recurrence end date on Safari or Internet Explorer
- Fix a bug: build status badge is not working
- Fix a bug: unable to set date formats during installation

View File

@ -61,6 +61,14 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
templateUrl: '/admin/invoices/settings/editPrefix.html'
};
// Payment Schedule PDF filename settings (and example)
$scope.scheduleFile = {
prefix: settings.payment_schedule_prefix,
nextId: 11,
date: moment().format('DDMMYYYY'),
templateUrl: '/admin/invoices/settings/editSchedulePrefix.html'
};
// Invoices parameters
$scope.invoice = {
logo: null,
@ -529,6 +537,38 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
});
};
/**
* Open a modal dialog allowing the user to edit the prefix of the payment schedules file names
*/
$scope.openEditSchedulePrefix = function () {
const modalInstance = $uibModal.open({
animation: true,
templateUrl: $scope.scheduleFile.templateUrl,
size: 'lg',
resolve: {
model () { return $scope.scheduleFile.prefix; }
},
controller: ['$scope', '$uibModalInstance', 'model', function ($scope, $uibModalInstance, model) {
$scope.model = model;
$scope.ok = function () { $uibModalInstance.close($scope.model); };
$scope.cancel = function () { $uibModalInstance.dismiss('cancel'); };
}]
});
modalInstance.result.then(function (model) {
Setting.update({ name: 'payment_schedule_prefix' }, { value: model }, function (data) {
$scope.scheduleFile.prefix = model;
return growl.success(_t('app.admin.invoices.prefix_successfully_saved'));
}
, function (error) {
if (error.status === 304) return;
growl.error(_t('app.admin.invoices.an_error_occurred_while_saving_the_prefix'));
console.error(error);
});
});
};
/**
* Callback to save the value of the text zone when editing is done
*/

View File

@ -874,7 +874,7 @@ angular.module('application.router', ['ui.router'])
"'accounting_VAT_code', 'accounting_VAT_label', 'accounting_subscription_code', 'accounting_subscription_label', " +
"'accounting_Machine_code', 'accounting_Machine_label', 'accounting_Training_code', 'accounting_Training_label', " +
"'accounting_Event_code', 'accounting_Event_label', 'accounting_Space_code', 'accounting_Space_label', " +
"'payment_gateway', 'accounting_Error_code', 'accounting_Error_label', " +
"'payment_gateway', 'accounting_Error_code', 'accounting_Error_label', 'payment_schedule_prefix', " +
"'feature_tour_display', 'online_payment_module', 'stripe_public_key', 'stripe_currency', 'invoice_prefix']"
}).$promise;
}],

View File

@ -30,6 +30,38 @@
}
}
.schedule-file {
text-align: center;
line-height: 4em;
margin-top: 2em;
.fa-stack {
position: relative;
width: 60px;
height: 75px;
.fa-file-pdf {
font-size: 4em;
vertical-align: middle;
position: absolute;
background-color: white;
text-shadow: 0 0 2px white;
}
}
.filename {
font-size: 1.1em;
vertical-align: middle;
margin-left: 1em;
.prefix:hover {
background-color: $yellow;
overflow-x: hidden;
}
}
}
.invoice-placeholder {
width: 80%;
max-width: 800px;

View File

@ -92,6 +92,14 @@
<i class="fa fa-file-pdf-o" aria-hidden="true"></i>
<span class="filename"><span class="prefix" ng-click="openEditPrefix()">{{file.prefix}}</span>-{{file.nextId}}_{{file.date}}.pdf</span>
</div>
<div class="schedule-file">
<h3 class="m-l" translate>{{ 'app.admin.invoices.schedule_filename' }}</h3>
<span class="fa-stack">
<i class="fa fa-file-pdf" style="top: 0; left: 0" aria-hidden="true"></i>
<i class="fa fa-file-pdf" style="top: 10px; left: 10px" aria-hidden="true"></i>
</span>
<span class="filename"><span class="prefix" ng-click="openEditSchedulePrefix()">{{scheduleFile.prefix}}</span>-{{scheduleFile.nextId}}_{{scheduleFile.date}}.pdf</span>
</div>
<script type="text/ng-template" id="addYear.html">

View File

@ -0,0 +1,20 @@
<div class="custom-invoice">
<div class="modal-header">
<h3 class="modal-title" translate>{{ 'app.admin.invoices.filename' }}</h3>
</div>
<div class="modal-body">
<p class="alert alert-info m-h-md" translate>
{{ 'app.admin.invoices.schedule_prefix_info' }}
</p>
<div>
<div class="model">
<label for="prefix" translate>{{ 'app.admin.invoices.prefix' }}</label>
<input type="text" id="prefix" class="form-control" ng-model="model">
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-warning" ng-click="ok()" translate>{{ 'app.shared.buttons.confirm' }}</button>
<button class="btn btn-default" ng-click="cancel()" translate>{{ 'app.shared.buttons.cancel' }}</button>
</div>
</div>

View File

@ -530,7 +530,9 @@ en:
logo_successfully_saved: "Logo successfully saved."
an_error_occurred_while_saving_the_logo: "An error occurred while saving the logo."
filename: "File name"
schedule_filename: "Schedule file name"
prefix_info: "The invoices will be generated as PDF files, named with the following prefix."
schedule_prefix_info: "The payment schedules will be generated as PDF files, named with the following prefix."
prefix: "Prefix"
prefix_successfully_saved: "File prefix successfully saved"
an_error_occurred_while_saving_the_prefix: "An error occurred while saving the file prefix"

View File

@ -530,7 +530,9 @@ fr:
logo_successfully_saved: "Le logo bien été enregistré."
an_error_occurred_while_saving_the_logo: "Une erreur est survenue lors de l'enregistrement du logo."
filename: "Nom de fichier"
schedule_filename: "Nom de fichier des échéanciers"
prefix_info: "Les factures seront générées sous la forme de fichiers PDF, nommés avec le préfixe suivant."
schedule_prefix_info: "Les échéanciers de paiement seront générées sous la forme de fichiers PDF, nommés avec le préfixe suivant."
prefix: "Préfixe"
prefix_successfully_saved: "Le préfixe de fichier a bien été enregistré"
an_error_occurred_while_saving_the_prefix: "Une erreur est survenue lors de l'enregistrement du préfixe de fichier"