Optional description for shifts
This commit is contained in:
parent
6c783e7faa
commit
a1f5454bf5
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Migrations;
|
||||
|
||||
use Engelsystem\Database\Migration\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class AddShiftsDescription extends Migration
|
||||
{
|
||||
use Reference;
|
||||
|
||||
/**
|
||||
* Run the migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$this->schema->table(
|
||||
'Shifts',
|
||||
function (Blueprint $table) {
|
||||
$table->text('description')->nullable()->after('shifttype_id');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->schema->table(
|
||||
'Shifts',
|
||||
function (Blueprint $table) {
|
||||
$table->dropColumn('description');
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
|
@ -86,6 +86,7 @@ function shift_edit_controller()
|
|||
|
||||
$shifttype_id = $shift['shifttype_id'];
|
||||
$title = $shift['title'];
|
||||
$description = $shift['description'];
|
||||
$rid = $shift['RID'];
|
||||
$start = $shift['start'];
|
||||
$end = $shift['end'];
|
||||
|
@ -93,6 +94,7 @@ function shift_edit_controller()
|
|||
if ($request->hasPostData('submit')) {
|
||||
// Name/Bezeichnung der Schicht, darf leer sein
|
||||
$title = strip_request_item('title');
|
||||
$description = strip_request_item('description');
|
||||
|
||||
// Auswahl der sichtbaren Locations für die Schichten
|
||||
if (
|
||||
|
@ -152,6 +154,7 @@ function shift_edit_controller()
|
|||
if ($valid) {
|
||||
$shift['shifttype_id'] = $shifttype_id;
|
||||
$shift['title'] = $title;
|
||||
$shift['description'] = $description;
|
||||
$shift['RID'] = $rid;
|
||||
$shift['start'] = $start;
|
||||
$shift['end'] = $end;
|
||||
|
@ -171,6 +174,7 @@ function shift_edit_controller()
|
|||
. '\' from ' . date('Y-m-d H:i', $start)
|
||||
. ' to ' . date('Y-m-d H:i', $end)
|
||||
. ' with angel types ' . join(', ', $needed_angel_types_info)
|
||||
. ' and description ' . $description
|
||||
);
|
||||
success(__('Shift updated.'));
|
||||
|
||||
|
@ -199,6 +203,8 @@ function shift_edit_controller()
|
|||
form_select('rid', __('Room:'), $rooms, $rid),
|
||||
form_text('start', __('Start:'), date('Y-m-d H:i', $start)),
|
||||
form_text('end', __('End:'), date('Y-m-d H:i', $end)),
|
||||
form_textarea('description', __('Additional description'), $description),
|
||||
__('This description is for single shifts, otherwise please use the description in shift type.'),
|
||||
'<h2>' . __('Needed angels') . '</h2>',
|
||||
$angel_types_spinner,
|
||||
form_submit('submit', __('Save'))
|
||||
|
|
|
@ -535,6 +535,7 @@ function Shift_update($shift)
|
|||
`end` = ?,
|
||||
`RID` = ?,
|
||||
`title` = ?,
|
||||
`description` = ?,
|
||||
`URL` = ?,
|
||||
`edited_by_user_id` = ?,
|
||||
`edited_at_timestamp` = ?
|
||||
|
@ -546,6 +547,7 @@ function Shift_update($shift)
|
|||
$shift['end'],
|
||||
$shift['RID'],
|
||||
$shift['title'],
|
||||
$shift['description'],
|
||||
$shift['URL'],
|
||||
$user->id,
|
||||
time(),
|
||||
|
@ -569,12 +571,13 @@ function Shift_create($shift)
|
|||
`end`,
|
||||
`RID`,
|
||||
`title`,
|
||||
`description`,
|
||||
`URL`,
|
||||
`created_by_user_id`,
|
||||
`edited_at_timestamp`,
|
||||
`created_at_timestamp`
|
||||
)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
',
|
||||
[
|
||||
$shift['shifttype_id'],
|
||||
|
@ -582,6 +585,7 @@ function Shift_create($shift)
|
|||
$shift['end'],
|
||||
$shift['RID'],
|
||||
$shift['title'],
|
||||
$shift['description'],
|
||||
$shift['URL'],
|
||||
auth()->user()->id,
|
||||
time(),
|
||||
|
|
|
@ -29,6 +29,7 @@ function admin_shifts()
|
|||
$change_hours = [];
|
||||
$title = '';
|
||||
$shifttype_id = null;
|
||||
$description = null;
|
||||
// When true: creates a shift beginning at the last shift change hour and ending at the first shift change hour
|
||||
$shift_over_midnight = true;
|
||||
|
||||
|
@ -70,6 +71,9 @@ function admin_shifts()
|
|||
// Name/Bezeichnung der Schicht, darf leer sein
|
||||
$title = strip_request_item('title');
|
||||
|
||||
// Beschreibung der Schicht, darf leer sein
|
||||
$description = strip_request_item('description');
|
||||
|
||||
// Auswahl der sichtbaren Locations für die Schichten
|
||||
if (
|
||||
$request->has('rid')
|
||||
|
@ -194,7 +198,8 @@ function admin_shifts()
|
|||
'end' => $end,
|
||||
'RID' => $rid,
|
||||
'title' => $title,
|
||||
'shifttype_id' => $shifttype_id
|
||||
'shifttype_id' => $shifttype_id,
|
||||
'description' => $description,
|
||||
];
|
||||
} elseif ($mode == 'multi') {
|
||||
$shift_start = (int)$start;
|
||||
|
@ -213,7 +218,8 @@ function admin_shifts()
|
|||
'end' => $shift_end,
|
||||
'RID' => $rid,
|
||||
'title' => $title,
|
||||
'shifttype_id' => $shifttype_id
|
||||
'shifttype_id' => $shifttype_id,
|
||||
'description' => $description,
|
||||
];
|
||||
|
||||
$shift_start = $shift_end;
|
||||
|
@ -323,6 +329,7 @@ function admin_shifts()
|
|||
form([
|
||||
$hidden_types,
|
||||
form_hidden('shifttype_id', $shifttype_id),
|
||||
form_hidden('description', $description),
|
||||
form_hidden('title', $title),
|
||||
form_hidden('rid', $rid),
|
||||
form_hidden('start', date('Y-m-d H:i', $start)),
|
||||
|
@ -357,6 +364,7 @@ function admin_shifts()
|
|||
engelsystem_log(
|
||||
'Shift created: ' . $shifttypes[$shift['shifttype_id']]
|
||||
. ' with title ' . $shift['title']
|
||||
. ' with description ' . $shift['description']
|
||||
. ' from ' . date('Y-m-d H:i', $shift['start'])
|
||||
. ' to ' . date('Y-m-d H:i', $shift['end'])
|
||||
);
|
||||
|
@ -413,9 +421,17 @@ function admin_shifts()
|
|||
return page_with_title(admin_shifts_title(), [
|
||||
msg(),
|
||||
form([
|
||||
div('row',[
|
||||
div('col-md-6', [
|
||||
form_select('shifttype_id', __('Shifttype'), $shifttypes, $shifttype_id),
|
||||
form_text('title', __('Title'), $title),
|
||||
form_select('rid', __('Room'), $room_array, $rid),
|
||||
]),
|
||||
div('col-md-6', [
|
||||
form_textarea('description', __('Additional description'), $description),
|
||||
__('This description is for single shifts, otherwise please use the description in shift type.'),
|
||||
]),
|
||||
]),
|
||||
div('row', [
|
||||
div('col-md-6', [
|
||||
form_datetime('start', __('Start'), $start),
|
||||
|
|
|
@ -176,7 +176,8 @@ function Shift_view($shift, $shifttype, Room $room, $angeltypes_source, ShiftSig
|
|||
]),
|
||||
div('col-sm-6', [
|
||||
'<h2>' . __('Description') . '</h2>',
|
||||
$parsedown->parse($shifttype['description'])
|
||||
$parsedown->parse($shifttype['description']),
|
||||
$parsedown->parse($shift['description']),
|
||||
])
|
||||
]);
|
||||
|
||||
|
|
|
@ -1418,6 +1418,13 @@ msgstr "Karte"
|
|||
msgid "Create shifts"
|
||||
msgstr "Schichten erstellen"
|
||||
|
||||
#: includes/pages/admin_shifts.php
|
||||
msgid "Additional description"
|
||||
msgstr "Zusätzliche Beschreibung"
|
||||
|
||||
msgid "This description is for single shifts, otherwise please use the description in shift type."
|
||||
msgstr "Diese Beschreibung ist für einzelne Schichten, ansonsten nutze bitte die Beschreibung im Schichttyp."
|
||||
|
||||
#: includes/pages/admin_shifts.php:82
|
||||
msgid "Please select a location."
|
||||
msgstr "Bitte einen Ort auswählen."
|
||||
|
|
Loading…
Reference in New Issue