Report Strono-Date, Booking+Fewo Notice, Custom Mail opti

This commit is contained in:
Kevin Adametz 2021-04-23 14:55:48 +02:00
parent 644ec93c53
commit 5d55e5be3f
35 changed files with 581 additions and 41 deletions

12
.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,12 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "post-update-cmd",
"type": "shell",
"command": "composer run-script post-update-cmd",
}
]
}

View file

@ -43,7 +43,7 @@ class ReportController extends Controller
private function prozessBookingSearch()
{
$query = Booking::with( 'customer', 'lead', 'service_provider_entries', 'service_provider_entries.service_provider')->select('booking.*');
$query = Booking::with( 'customer', 'lead', 'booking_strono','service_provider_entries', 'service_provider_entries.service_provider')->select('booking.*');
if(Request::get('filter_travel_date_from') != ""){
$travel_date_from = Carbon::parse(Request::get('filter_travel_date_from'))->format("Y-m-d");
@ -106,6 +106,9 @@ class ReportController extends Controller
->addColumn('booking_date', function (Booking $booking) {
return $booking->getBookingDateFormat();
})
->addColumn('booking_strono_date', function (Booking $booking) {
return $booking->booking_strono ? $booking->booking_strono->storno_date->format("d.m.Y") : "";
})
->addColumn('service_provider.names', function (Booking $booking) {
$ret = "";
if($booking->service_provider_entries){
@ -154,7 +157,6 @@ class ReportController extends Controller
public function bookingsExport(){
$query = $this->prozessBookingSearch();
$order = explode(",", Request::get('order'));
@ -183,6 +185,7 @@ class ReportController extends Controller
$headers = array(
'BuchungsID',
'Status',
'Storno',
'MyJack Nr.',
'Organisation',
'Reisepreis',
@ -206,6 +209,7 @@ class ReportController extends Controller
$total_amount_final = 0;
foreach($exports as $export) {
$storno_date = $export->booking_strono ? $export->booking_strono->storno_date->format("d.m.Y") : "";
if($export->service_provider_entries->count()){
$new = true;
foreach ($export->service_provider_entries as $service_provider_entry){
@ -218,6 +222,7 @@ class ReportController extends Controller
$columns[] = array(
'BuchungsID' => $new ? $export->id : "",
'Status' => $new ? $export->lead->status->name : "",
'Storno' => $new ? $storno_date : "",
'MyJack Nr.' => $new ? $export->merlin_order_number : "",
'Organisation' => $new ? $export->price : "",
'Reisepreis' => $new ? $export->price_total : "",
@ -243,6 +248,7 @@ class ReportController extends Controller
$columns[] = array(
'BuchungsID' => $export->id,
'Status' => $export->lead->status->name,
'Storno' => $storno_date,
'MyJack Nr.' => $export->merlin_order_number,
'Organisation' => $export->price,
'Reisepreis' => $export->price_total,
@ -266,6 +272,7 @@ class ReportController extends Controller
$columns[] = array(
'BuchungsID' => "Total",
'Status' => "",
'Storno' => "",
'MyJack Nr.' => "",
'Organisation' => Util::_number_format($total_price),
'Reisepreis' => Util::_number_format($total_price_total),

View file

@ -2,15 +2,16 @@
namespace App\Http\Controllers;
use App\Models\Booking;
use App\Models\BookingDraftItem;
use App\Models\BookingFile;
use App\Models\Customer;
use App\Repositories\BookingFileRepository;
use App\Repositories\BookingRepository;
use App\Repositories\CustomerMailRepository;
use App\Repositories\DraftRepository;
use Request;
use App\Models\Booking;
use App\Models\Customer;
use App\Models\BookingFile;
use App\Models\BookingNotice;
use App\Models\BookingDraftItem;
use App\Repositories\DraftRepository;
use App\Repositories\BookingRepository;
use App\Repositories\BookingFileRepository;
use App\Repositories\CustomerMailRepository;
class BookingController extends Controller
{
@ -63,7 +64,12 @@ class BookingController extends Controller
\Session()->flash('alert-save', '1');
return redirect(route('booking_detail', [$booking->id])."#collapseBookingNotice");
}
if($data['action'] === 'edit_notice'){
$booking = $this->bookingRepo->updateNotice($id, $data);
\Session()->flash('alert-save', '1');
return redirect(route('booking_detail', [$booking->id])."#collapseBookingNotice");
}
if($data['action'] === 'update_booking'){
$booking = $this->bookingRepo->updateBooking($id, $data);
\Session()->flash('alert-save', '1');
@ -220,6 +226,11 @@ class BookingController extends Controller
$ret = view("booking.upload_modal", compact('data'))->render();
}
if($data['action'] === "edit_notice") {
$value = BookingNotice::findOrFail($data['id']);
$ret = view("booking.edit_notice_modal", compact('data', 'value'))->render();
}
if($data['action'] === "upload-booking-file"){
if($data['booking_id']){
$bookingFileRepo = new BookingFileRepository(new BookingFile());
@ -274,6 +285,14 @@ class BookingController extends Controller
\Session()->flash('alert-success', 'Datei gelöscht');
return redirect(route('booking_detail', [$booking->id]));
}
if($del === 'booking_notice'){
$booking_notice = BookingNotice::findOrFail($id);
$booking = $booking_notice->booking;
$booking_notice->delete();
\Session()->flash('alert-success', 'Notiz gelöscht');
return redirect(route('booking_detail', [$booking->id]));
}
if($del === 'passolution_file'){
$booking = Booking::findOrFail($id);
$booking->resyncPassolutionPDF();

View file

@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Models\BookingNotice;
use App\Models\SfGuardUser;
use App\Models\TravelUserBookingFewoNotice;
use App\User;
use Auth;
use Carbon\Carbon;
@ -42,10 +43,12 @@ class HomeController extends Controller
return redirect('login');
}
$last_booking_notices = BookingNotice::orderBy('created_at', 'DESC')->limit(10)->get();
$last_booking_notices = BookingNotice::orderBy('edit_at', 'DESC')->orderBy('created_at', 'DESC')->limit(10)->get();
$last_booking_fewo_notices = TravelUserBookingFewoNotice::orderBy('edit_at', 'DESC')->orderBy('created_at', 'DESC')->limit(10)->get();
$data = [
'user' => Auth::user(),
'last_booking_notices' => $last_booking_notices,
'last_booking_fewo_notices' => $last_booking_fewo_notices
];
return view('home', $data);
}

View file

@ -384,8 +384,6 @@ class RequestController extends Controller
'<span data-order="0" class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
})
->addColumn('sf_guard_user_id', function (Booking $booking) {
return '<span data-order="'.($booking->sf_guard_user_id ? $booking->sf_guard_user_id : 0).'">'.($booking->sf_guard_user_id? $booking->sf_guard_user->first_name." ".$booking->sf_guard_user->last_name : "-").'</span>';
})

View file

@ -11,6 +11,7 @@ use App\Models\FewoLodging;
use App\Models\FewoReservation;
use App\Models\TravelBookingFewoChannel;
use App\Models\TravelUserBookingFewo;
use App\Models\TravelUserBookingFewoNotice;
use App\Models\TravelUserBookingFile;
use App\Repositories\BookingFewoFileRepository;
use App\Repositories\TravelUserBookingFewoRepository;
@ -82,6 +83,18 @@ class TravelUserBookingFewoController extends Controller
public function store($id)
{
$data = Request::all();
if($data['action'] === 'save_notice'){
$travel_user_booking_fewo = $this->userBookingFewoRepo->updateNotice($id, $data);
\Session()->flash('alert-save', '1');
return redirect(route('travel_user_booking_fewo_detail', [$travel_user_booking_fewo->id])."#collapseBookingNotice");
}
if($data['action'] === 'edit_notice'){
$travel_user_booking_fewo = $this->userBookingFewoRepo->updateNotice($id, $data);
\Session()->flash('alert-save', '1');
return redirect(route('travel_user_booking_fewo_detail', [$travel_user_booking_fewo->id])."#collapseBookingNotice");
}
if($data['action'] === 'saveAll'){
return $this->userBookingFewoRepo->update($id, $data);
}
@ -183,6 +196,19 @@ class TravelUserBookingFewoController extends Controller
}
}
public function loadModal(){
$data = Request::all();
$ret = "";
if(Request::ajax()) {
if($data['action'] === "edit_notice") {
$value = TravelUserBookingFewoNotice::findOrFail($data['id']);
$ret = view("travel.user.booking.edit_notice_modal", compact('data', 'value'))->render();
}
}
return response()->json(['response' => $data, 'html'=>$ret]);
}
public function delete($id, $del="travel_user_booking_fewo"){
if($del === 'travel_user_booking_fewo') {
@ -206,6 +232,14 @@ class TravelUserBookingFewoController extends Controller
\Session()->flash('alert-success', __('Buchung gelöscht sowie die Reservierung im Sterntrous Kalender'));
}
if($del === 'booking_fewo_notices'){
$booking_fewo_notice = TravelUserBookingFewoNotice::findOrFail($id);
$travel_user_booking_fewo = $booking_fewo_notice->travel_user_booking_fewo;
$booking_fewo_notice->delete();
\Session()->flash('alert-success', 'Notiz gelöscht');
return redirect(route('travel_user_booking_fewo_detail', [$travel_user_booking_fewo->id]));
}
if($del === 'booking_fewo_files'){
$booking_fewo_file = TravelUserBookingFile::findOrFail($id);

View file

View file

@ -176,6 +176,13 @@ use Illuminate\Database\Eloquent\Model;
* @property-read int|null $booking_provider_services_count
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BookingProviderService[] $booking_provider_services_checked
* @property-read int|null $booking_provider_services_checked_count
* @property bool|null $comfort
* @property int|null $nationality_id
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BookingNotice[] $booking_notices
* @property-read int|null $booking_notices_count
* @property-read \App\Models\TravelNationality|null $travel_nationality
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereComfort($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereNationalityId($value)
*/
class Booking extends Model
{
@ -529,6 +536,11 @@ class Booking extends Model
return $this->hasMany(BookingNotice::class, 'booking_id')->orderBy('created_at', 'DESC');
}
public function booking_strono()
{
return $this->hasOne(BookingStorno::class);
}
public function hasBookingServicesUnchecked(){
$country_services = true;
$provider_services = true;

View file

@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class BookingNotice
*
*
* @property int $id
* @property int $booking_id
* @property int $from_user_id
@ -20,13 +20,28 @@ use Illuminate\Database\Eloquent\Model;
* @property string $message
* @property bool $show
* @property bool $important
* @property Carbon $edit_at
* @property Carbon $created_at
* @property Carbon $updated_at
*
* @property Booking $booking
* @property User $user
*
* @package App\Models
* @property-read \App\User $from_user
* @property-read \App\User|null $to_user
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereBookingId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereEditAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereFromUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereImportant($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereMessage($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereShow($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereToUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereUpdatedAt($value)
* @mixin \Eloquent
*/
class BookingNotice extends Model
{
@ -40,13 +55,18 @@ class BookingNotice extends Model
'important' => 'bool'
];
protected $dates = [
'edit_at',
];
protected $fillable = [
'booking_id',
'from_user_id',
'to_user_id',
'message',
'show',
'important'
'important',
'edit_at'
];
public function booking()

View file

@ -36,6 +36,8 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereTotal($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereUpdatedAt($value)
* @mixin \Eloquent
* @property \Illuminate\Support\Carbon|null $storno_print
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereStornoPrint($value)
*/
class BookingStorno extends Model
{
@ -49,7 +51,8 @@ class BookingStorno extends Model
];
protected $dates = [
'storno_date'
'storno_date',
'storno_print'
];
protected $fillable = [
@ -57,6 +60,7 @@ class BookingStorno extends Model
'total',
'storno',
'storno_date',
'storno_print',
'binary_data',
'done'
];

View file

@ -81,6 +81,8 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoMail whereDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoMail withTrashed()
* @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoMail withoutTrashed()
* @property array|null $forward
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoMail whereForward($value)
*/
class CustomerFewoMail extends Model
{

View file

@ -77,6 +77,8 @@ use Illuminate\Database\Eloquent\Model;
* @mixin \Eloquent
* @property int|null $subdir
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereSubdir($value)
* @property array|null $forward
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereForward($value)
*/
class CustomerMail extends Model
{

View file

@ -33,6 +33,9 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant whereParticipantName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant whereParticipantSalutationId($value)
* @mixin \Eloquent
* @property int|null $nationality_id
* @property-read \App\Models\TravelNationality|null $travel_nationality
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant whereNationalityId($value)
*/
class Participant extends Model
{

View file

@ -53,6 +53,7 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser query()
* @property-read \App\User|null $user
*/
class SfGuardUser extends Model
{

View file

@ -49,6 +49,8 @@ use Illuminate\Database\Eloquent\Model;
* @property-read \App\Models\TravelCountry|null $stern_travel_country
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TravelCountryService[] $travel_country_services
* @property-read int|null $travel_country_services_count
* @property string|null $destco
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\TravelCountry whereDestco($value)
*/
class TravelCountry extends Model
{

View file

@ -69,6 +69,8 @@ use Illuminate\Support\Str;
* @property-read \App\Models\Sym\TravelCountry|null $crm_travel_country
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TravelCountryService[] $travel_country_services
* @property-read int|null $travel_country_services_count
* @property string|null $destco
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCountry whereDestco($value)
*/
class TravelCountry extends Model
{

View file

@ -17,6 +17,8 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelNationality newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelNationality newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelNationality query()
* @property string|null $nat
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelNationality whereNat($value)
*/
class TravelNationality extends Model
{

View file

@ -251,6 +251,11 @@ class TravelUserBookingFewo extends Model
return $this->hasOne(CustomerFewoMail::class, 'travel_user_booking_fewo_id')->latest();
}
public function booking_fewo_notices()
{
return $this->hasMany(TravelUserBookingFewoNotice::class, 'travel_user_booking_fewo_id')->orderBy('created_at', 'DESC');
}
public function getStatuesName(){
if(isset(self::$statues[$this->status])){
return self::$statues[$this->status];

View file

@ -0,0 +1,92 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use App\User;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class TravelUserBookingFewoNotice
*
* @property int $id
* @property int $travel_user_booking_fewo_id
* @property int $from_user_id
* @property int $to_user_id
* @property string $message
* @property bool $show
* @property bool $important
* @property Carbon $edit_at
* @property Carbon $created_at
* @property Carbon $updated_at
*
* @property TravelUserBookingFewo $travel_user_booking_fewo
*
* @package App\Models
*/
class TravelUserBookingFewoNotice extends Model
{
protected $connection = 'mysql_stern';
protected $table = 'travel_user_booking_fewo_notices';
protected $casts = [
'travel_user_booking_fewo_id' => 'int',
'from_user_id' => 'int',
'to_user_id' => 'int',
'show' => 'bool',
'important' => 'bool'
];
protected $dates = [
'edit_at'
];
protected $fillable = [
'travel_user_booking_fewo_id',
'from_user_id',
'to_user_id',
'message',
'show',
'important',
'edit_at'
];
public function travel_user_booking_fewo()
{
return $this->belongsTo(TravelUserBookingFewo::class);
}
public function to_user()
{
return $this->belongsTo(User::class, 'to_user_id');
}
public function from_user()
{
return $this->belongsTo(User::class, 'from_user_id');
}
public function getName(){
if($this->from_user){
if($this->from_user->sf_guard_user){
return $this->from_user->sf_guard_user->first_name." ".$this->from_user->sf_guard_user->last_name;
}else{
$this->from_user->name;
}
}
}
public function getSmallerMessage($max = 500){
$ret = substr($this->message, 0, $max);
if(strlen($this->message) > 500){
$ret .= " ...";
}
return $ret;
}
}

View file

@ -27,13 +27,22 @@ class BookingRepository extends BaseRepository {
public function updateNotice($id, $data){
$this->model = Booking::findOrFail($id);
BookingNotice::create([
'booking_id' => $this->model->id,
'from_user_id' => Auth::user()->id,
'to_user_id' => isset($this->model->sf_guard_user->user_id) ? $this->model->sf_guard_user->user_id : null,
'message' => isset($data['booking_notice']) ? $data['booking_notice'] : "",
]
);
if($data['action'] === 'edit_notice' && isset($data['notice_id'])){
$BookingNotice = BookingNotice::findOrFail($data['notice_id']);
$BookingNotice->message = isset($data['booking_notice']) ? $data['booking_notice'] : "";
$BookingNotice->edit_at = now();
$BookingNotice->save();
}else{
//save_notice
BookingNotice::create([
'booking_id' => $this->model->id,
'from_user_id' => Auth::user()->id,
'to_user_id' => isset($this->model->sf_guard_user->user_id) ? $this->model->sf_guard_user->user_id : null,
'message' => isset($data['booking_notice']) ? $data['booking_notice'] : "",
]
);
}
return $this->model;
}

View file

@ -11,6 +11,7 @@ use App\Models\TravelClass;
use App\Models\TravelProgram;
use App\Models\TravelProgramDraft;
use App\Models\TravelUserBookingFewo;
use App\Models\TravelUserBookingFewoNotice;
use App\Services\Util;
use PDF;
use Carbon\Carbon;
@ -26,6 +27,26 @@ class TravelUserBookingFewoRepository extends BaseRepository {
$this->model = $model;
}
public function updateNotice($id, $data){
$model = TravelUserBookingFewo::findOrFail($id);
if($data['action'] === 'edit_notice' && isset($data['notice_id'])){
$BookingNotice = TravelUserBookingFewoNotice::findOrFail($data['notice_id']);
$BookingNotice->message = isset($data['booking_fewo_notice']) ? $data['booking_fewo_notice'] : "";
$BookingNotice->edit_at = now();
$BookingNotice->save();
}else{
//save_notice
TravelUserBookingFewoNotice::create([
'travel_user_booking_fewo_id' => $model->id,
'from_user_id' => \Auth::user()->id,
'message' => isset($data['booking_fewo_notice']) ? $data['booking_fewo_notice'] : "",
]
);
}
return $model;
}
public function createTravelInfoPDF($id, $travel_info_user_text){
@ -252,7 +273,6 @@ class TravelUserBookingFewoRepository extends BaseRepository {
return redirect(route('travel_user_booking_fewo_detail', [$model->id]));
}
private function calculatePriceNew(TravelUserBookingFewo $travel_user_booking_fewo){
$FewoSeasons = FewoSeason::where('from_date', '<', $travel_user_booking_fewo->getToDateRaw())

View file

@ -77,6 +77,7 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
* @property-read int|null $notifications_count
* @property-read int|null $tokens_count
* @property-read int|null $user_update_email_count
* @property-read \App\Models\SfGuardUser|null $sf_guard_user
*/
class User extends Authenticatable
{
@ -84,6 +85,7 @@ class User extends Authenticatable
use SoftDeletes;
protected $connection = 'mysql';
protected $permissionData = [];

View file

@ -33,6 +33,8 @@ return [
'cms-cn-au' => ['name' => 'ADMIN CMS > Inhalte > Autor' , 'color' => 'secondary'],
],
2 => [
'sua-bo-n-edit' => ['name' => 'SUPERADMIN > Buchungen > Notizen > bearbeiten' , 'color' => 'secondary'],
'sua-fewo-n-edit' => ['name' => 'SUPERADMIN > FeWo > Notizen > bearbeiten' , 'color' => 'secondary'],
'sua-st' => ['name' => 'SUPERADMIN > Einstellungen' , 'color' => 'superadmin'],
'sua-st-al' => ['name' => 'SUPERADMIN > Einstellungen > Airline' , 'color' => 'superadmin'],
'sua-st-em' => ['name' => 'SUPERADMIN > Einstellungen > E-Mails' , 'color' => 'superadmin'],

View file

@ -23,6 +23,7 @@ class CreateBookingStornoTable extends Migration
$table->decimal('total', 10, 2)->default(0.00);
$table->decimal('storno', 10, 2)->default(0.00);
$table->date('storno_date')->nullable();
$table->date('storno_print')->nullable();
$table->binary('binary_data');
$table->tinyInteger('done')->nullable()->default(0);
$table->dateTime('created_at');

View file

@ -25,6 +25,8 @@ class CreateBookingNoticesTable extends Migration
$table->boolean('show')->default(false);
$table->boolean('important')->default(false);
$table->timestamp('edit_at')->nullable();
$table->timestamps();
$table->foreign('booking_id')

View file

@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateBookingFewoNoticesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('mysql_stern')->create('booking_fewo_notices', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedInteger('travel_user_booking_fewo_id');
//from
$table->unsignedInteger('from_user_id');
//to
$table->unsignedInteger('to_user_id')->nullable();
$table->text('message')->nullable();
$table->boolean('show')->default(false);
$table->boolean('important')->default(false);
$table->timestamp('edit_at')->nullable();
$table->timestamps();
$table->foreign('travel_user_booking_fewo_id')
->references('id')
->on('travel_user_booking_fewos')
->onDelete('CASCADE');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('mysql_stern')->dropIfExists('booking_fewo_notices');
}
}

View file

@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTravelUserBookingFewoNoticesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('mysql_stern')->create('travel_user_booking_fewo_notices', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedInteger('travel_user_booking_fewo_id');
//from
$table->unsignedInteger('from_user_id');
//to
$table->unsignedInteger('to_user_id')->nullable();
$table->text('message')->nullable();
$table->boolean('show')->default(false);
$table->boolean('important')->default(false);
$table->timestamp('edit_at')->nullable();
$table->timestamps();
$table->foreign('travel_user_booking_fewo_id', 'travel_user_booking_fewo_notices_id_foreign')
->references('id')
->on('travel_user_booking_fewos')
->onDelete('CASCADE');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('mysql_stern')->dropIfExists('travel_user_booking_fewo_notices');
}
}

View file

@ -64,6 +64,7 @@
<tr>
<th>BuchungsID</th>
<th>{{__('Status')}}</th>
<th>{{__('Storno')}}</th>
<th>{{__('MyJack Nr.')}}</th>
<th>{{__('Organisation')}}</th>
<th>{{__('Reisepreis')}}</th>
@ -111,6 +112,7 @@
"columns": [
{ data: 'id', name: 'id' },
{ data: 'lead.status_id', name: 'lead.status_id', orderable: false, searchable: false },
{ data: 'booking_strono_date', name: 'booking_strono_date', orderable: false, searchable: false },
{ data: 'merlin_order_number', name: 'merlin_order_number' },
{ data: 'price', name: 'price' },
{ data: 'price_total', name: 'price_total' },
@ -121,7 +123,7 @@
{ data: 'booking_date', name: 'booking_date' },
{ data: 'service_provider.names', name: 'service_provider.names', orderable: false },
],
"order": [[ 7, "asc" ]],
"order": [[ 10, "desc" ]],
"orderSequence": ["desc", "asc"],
"bLengthChange": false,
"iDisplayLength": 100,
@ -136,10 +138,10 @@
}
});
$('#filter_service_provider_id, #filter_is_cleared, #filter_sort_by').on('change', function(){
table.order( [ 7, 'asc' ] ).draw();
table.order( [ 10, 'desc' ] ).draw();
});
$('.datepicker-base').on('change', function(){
table.order( [ 7, 'asc' ] ).draw();
table.order( [ 10, 'desc' ] ).draw();
});
});
</script>

View file

@ -25,20 +25,35 @@
<div class="col-sm-12">
@if($booking_notice->from_user_id === \Auth::user()->id)
<div class="bg-primary rounded py-2 px-3 mr-3 text-white mb-2">
<div class="font-weight-semibold mb-1">{{ $booking_notice->getName() }} | {{ $booking_notice->created_at->format("d.m.Y - H:i:s") }}
@else
<div class="bg-secondary rounded py-2 px-3 mr-3 mb-2">
<div class="font-weight-semibold mb-1">{{ $booking_notice->getName() }} | {{ $booking_notice->created_at->format("d.m.Y - H:i:s") }}
@endif
<div class="font-weight-semibold mb-1">{{ $booking_notice->getName() }} | {{ $booking_notice->created_at->format("d.m.Y - H:i:s") }}</div>
{!! nl2br($booking_notice->message) !!}
</div>
</div>
{{-- <div class="col-sm-12">
<div class="bg-lighter rounded py-2 px-3 mr-3 mb-2">
<div class="font-weight-semibold mb-1">You | {{ $booking_notice->created_at->format("d.m.Y H:i:s") }}</div>
@if($booking_notice->edit_at != null)
| <i class="ion ion-ios-create"></i> {{ $booking_notice->edit_at->format("d.m.Y - H:i:s") }}
@endif
@if($booking_notice->from_user_id === \Auth::user()->id || \Auth::user()->isPermission('sua-bo-n-edit'))
<div class="float-right"><a href="">
<a href="javascript:void(0)" class="btn btn-xs btn-white" data-toggle="modal" data-target="#modals-load-content"
data-id="{{ $booking_notice->id }}"
data-model="BookingNotice"
data-action="edit_notice"
data-url="{{ route('booking_detail', [$booking->id]) }}"
data-redirect="back"
data-booking_id="{{$booking->id}}"
data-route="{{ route('booking_modal_load') }}">
<i class="ion ion-ios-create"></i>
</a>
<a href="{{ route('booking_delete', [$booking_notice->id, 'booking_notice']) }}" class="btn btn-xs btn-white text-danger" onclick="return confirm('Wirklich löschen?');"><i class="ion ion-md-trash"></i></a>
</div>
@endif
</div>
{!! nl2br($booking_notice->message) !!}
</div>
</div>
</div>
--}}
@endforeach
@endif
</div>

View file

@ -0,0 +1,31 @@
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">
{{ __('Notiz') }}
<span class="font-weight-light">bearbeiten</span>
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
</div>
{!! Form::open(['url' => $data['url'], 'class' => '', 'id'=>'edit-notice-form']) !!}
{{ Form::hidden('booking_id', $data['booking_id']) }}
{{ Form::hidden('action', $data['action']) }}
{{ Form::hidden('notice_id', $data['id']) }}
<div class="modal-body">
<div class="form-group">
<label for="full_text" class="form-label">{{ __('Notiz') }}</label>
{{ Form::textarea('booking_notice', $value->message, array('placeholder'=>__('Notiz bearbeiten'), 'class'=>'form-control', 'rows'=>8)) }}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">schließen</button>
<button type="submit" class="btn btn-primary" name="update-action" value="save-edit-notice">speichern</button>
</div>
{!! Form::close() !!}
</div>
<script type="text/javascript">
</script>

View file

@ -216,8 +216,11 @@
@else
<div class="bg-secondary rounded py-2 px-3 mr-3 mb-2">
@endif
<div class="font-weight-semibold mb-1">{{ $booking_notice->getName() }} | {{ $booking_notice->created_at->format("d.m.Y - H:i:s") }} |
<a class="btn btn-white btn-xs " href="{{ route('booking_detail', [$booking_notice->booking_id]) }}#collapseBookingNotice">zur Buchnung {{ $booking_notice->booking_id }}</a>
<div class="font-weight-semibold mb-1">{{ $booking_notice->getName() }} | {{ $booking_notice->created_at->format("d.m.Y - H:i:s") }}
@if($booking_notice->edit_at != null)
| <i class="ion ion-ios-create"></i> {{ $booking_notice->edit_at->format("d.m.Y - H:i:s") }}
@endif
| <a class="btn btn-white btn-xs " href="{{ route('booking_detail', [$booking_notice->booking_id]) }}#collapseBookingNotice">zur Buchnung {{ $booking_notice->booking_id }}</a>
</div>
{!! nl2br($booking_notice->message) !!}
</div>
@ -233,6 +236,39 @@
@endforeach
@endif
</div>
<div class="card-body mb-2" style="background: #fff; border: 1px solid rgba(24, 28, 33, 0.06);">
<h4>{{__('Notizen') }} FeWo <span class=" text-muted">letzten 10</span></h4>
@if($last_booking_fewo_notices)
@foreach($last_booking_fewo_notices as $booking_fewo_notice)
<div class="row">
<div class="col-sm-12">
@if($booking_fewo_notice->from_user_id === \Auth::user()->id)
<div class="bg-primary rounded py-2 px-3 mr-3 text-white mb-2">
@else
<div class="bg-secondary rounded py-2 px-3 mr-3 mb-2">
@endif
<div class="font-weight-semibold mb-1">{{ $booking_fewo_notice->getName() }} | {{ $booking_fewo_notice->created_at->format("d.m.Y - H:i:s") }}
@if($booking_fewo_notice->edit_at != null)
| <i class="ion ion-ios-create"></i> {{ $booking_fewo_notice->edit_at->format("d.m.Y - H:i:s") }}
@endif
| <a class="btn btn-white btn-xs " href="{{ route('travel_user_booking_fewo_detail', [$booking_fewo_notice->travel_user_booking_fewo_id]) }}#collapseBookingNotice">zur Buchnung {{ $booking_fewo_notice->travel_user_booking_fewo_id }}</a>
</div>
{!! nl2br($booking_fewo_notice->message) !!}
</div>
</div>
</div>
{{-- <div class="col-sm-12">
<div class="bg-lighter rounded py-2 px-3 mr-3 mb-2">
<div class="font-weight-semibold mb-1">You | {{ $booking_notice->created_at->format("d.m.Y H:i:s") }}</div>
{!! nl2br($booking_notice->message) !!}
</div>
</div>
--}}
@endforeach
@endif
</div>
@endif
<div class="card-body mb-2" style="background: #fff; border: 1px solid rgba(24, 28, 33, 0.06);">

View file

@ -0,0 +1,60 @@
<div class="card mb-2">
<h6 class="card-header bg-primary text-white py-2" data-toggle="collapse" data-target="#collapseBookingNotice" aria-expanded="false" aria-controls="collapseBookingNotice">
<strong style="line-height: 1.6em">Notizen</strong>
</h6>
<div class="collapse" id="collapseBookingNotice">
<div class="card-body row">
<div class="col-sm-12">
{!! Form::open(['url' => route('travel_user_booking_fewo_detail', [$id]), 'class' => 'form-horizontal']) !!} <input type="hidden" name="action" value="save_notice">
<div class="form-group">
{{ Form::textarea('booking_fewo_notice', '', array('placeholder'=>__('Neue Notiz hinzufügen …'), 'class'=>'form-control autoExpand', 'id'=>'booking_notice', 'rows'=>'1', 'data-min-rows'=>'1', 'required')) }}
</div>
<div class="form-group text-right">
<button type="submit" class="btn btn-sm btn-primary" ><i class="ion ion-ios-send"></i>&nbsp;Notiz hinzufügen</button>
<hr>
</div>
{!! Form::close() !!}
</div>
@if($travel_user_booking_fewo->booking_fewo_notices)
@foreach($travel_user_booking_fewo->booking_fewo_notices as $booking_fewo_notices)
<div class="col-sm-12">
@if($booking_fewo_notices->from_user_id === \Auth::user()->id)
<div class="bg-primary rounded py-2 px-3 mr-3 text-white mb-2">
<div class="font-weight-semibold mb-1">{{ $booking_fewo_notices->getName() }} | {{ $booking_fewo_notices->created_at->format("d.m.Y - H:i:s") }}
@else
<div class="bg-secondary rounded py-2 px-3 mr-3 mb-2">
<div class="font-weight-semibold mb-1">{{ $booking_fewo_notices->getName() }} | {{ $booking_fewo_notices->created_at->format("d.m.Y - H:i:s") }}
@endif
@if($booking_fewo_notices->edit_at != null)
| <i class="ion ion-ios-create"></i> {{ $booking_fewo_notices->edit_at->format("d.m.Y - H:i:s") }}
@endif
@if($booking_fewo_notices->from_user_id === \Auth::user()->id || \Auth::user()->isPermission('sua-bo-n-edit'))
<div class="float-right"><a href="">
<a href="javascript:void(0)" class="btn btn-xs btn-white" data-toggle="modal" data-target="#modals-load-content"
data-id="{{ $booking_fewo_notices->id }}"
data-model="TravelUserBookingFewoNotice"
data-action="edit_notice"
data-url="{{ route('travel_user_booking_fewo_detail', [$travel_user_booking_fewo->id]) }}"
data-redirect="back"
data-travel_user_booking_fewo_id="{{$travel_user_booking_fewo->id}}"
data-route="{{ route('travel_user_booking_fewo_modal_load') }}">
<i class="ion ion-ios-create"></i>
</a>
<a href="{{ route('travel_user_booking_fewo_delete', [$booking_fewo_notices->id, 'booking_fewo_notices']) }}" class="btn btn-xs btn-white text-danger" onclick="return confirm('Wirklich löschen?');"><i class="ion ion-md-trash"></i></a>
</div>
@endif
</div>
{!! nl2br($booking_fewo_notices->message) !!}
</div>
</div>
@endforeach
@endif
</div>
</div>
</div>

View file

@ -102,6 +102,11 @@
PDF Dateien
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="javascript:void(0)" data-collapse="#collapseBookingNotice">
Notizen
</a>
</li>
@endif
</ul>
@ -109,6 +114,7 @@
<input type="hidden" name="id" id="id" value="{{$id}}">
@include('travel.user.booking._detail_info')
@if($id !== "new")
@include('travel.user.booking._detail_invoice')
@include('travel.user.booking._detail_sm_mails')
@ -119,6 +125,9 @@
@include('travel.user.booking._detail_mails')
@include('travel.user.booking._detail_files')
@endif
@include('travel.user.booking._detail_notice')
<div class="float-right mt-2">
<a href="{{route('travel_user_booking_fewos')}}" class="btn btn-default btn-sm">{{ __('zur Übersicht') }}</a>
</div>

View file

@ -0,0 +1,31 @@
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">
{{ __('Notiz') }}
<span class="font-weight-light">bearbeiten</span>
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
</div>
{!! Form::open(['url' => $data['url'], 'class' => '', 'id'=>'edit-notice-form']) !!}
{{ Form::hidden('travel_user_booking_fewo_id', $data['travel_user_booking_fewo_id']) }}
{{ Form::hidden('action', $data['action']) }}
{{ Form::hidden('notice_id', $data['id']) }}
<div class="modal-body">
<div class="form-group">
<label for="full_text" class="form-label">{{ __('Notiz') }}</label>
{{ Form::textarea('booking_fewo_notice', $value->message, array('placeholder'=>__('Notiz bearbeiten'), 'class'=>'form-control', 'rows'=>8)) }}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">schließen</button>
<button type="submit" class="btn btn-primary" name="update-action" value="save-edit-notice">speichern</button>
</div>
{!! Form::close() !!}
</div>
<script type="text/javascript">
</script>

View file

@ -220,6 +220,8 @@ Route::group(['middleware' => ['admin']], function()
Route::get('/travel_user_booking_fewo/detail/{id}', 'TravelUserBookingFewoController@detail')->name('travel_user_booking_fewo_detail');
Route::post('/travel_user_booking_fewo/detail/{id}', 'TravelUserBookingFewoController@store')->name('travel_user_booking_fewo_detail');
Route::get('/travel_user_booking_fewo/delete/{id}/{del?}', 'TravelUserBookingFewoController@delete')->name('travel_user_booking_fewo_delete');
Route::post('/travel_user_booking_fewo/modal/load', 'TravelUserBookingFewoController@loadModal')->name('travel_user_booking_fewo_modal_load');
});
Route::group(['middleware' => ['auth.permission:cms-cn-in']], function() {
//CMS Infos