diff --git a/app/Http/Controllers/Admin/VenueCrudController.php b/app/Http/Controllers/Admin/VenueCrudController.php
index f68c4699..3b31b007 100644
--- a/app/Http/Controllers/Admin/VenueCrudController.php
+++ b/app/Http/Controllers/Admin/VenueCrudController.php
@@ -35,34 +35,40 @@ class VenueCrudController extends CrudController
// TODO: remove setFromDb() and manually define Fields and Columns
$this->crud->addColumns([
- ['name'=>'venue_name','type'=>'text','label'=>'Venue Name En'],
+// ['name'=>'venue_name','type'=>'text','label'=>'Venue Name En'],
['name'=>'venue_name_ru','type'=>'text','label'=>'Venue Name Ru'],
['name'=>'venue_name_tk','type'=>'text','label'=>'Venue Name Tk'],
['name'=>'active','type'=>'boolean','label'=>'Active']
]);
$this->crud->addFields([
- ['name'=>'venue_name','type'=>'text','label'=>'Venue Name En'],
- ['name'=>'venue_name_ru','type'=>'text','label'=>'Venue Name Ru'],
- ['name'=>'venue_name_tk','type'=>'text','label'=>'Venue Name Tk'],
+// ['name'=>'venue_name','type'=>'text','label'=>'Venue Name En'],
+ ['name'=>'venue_name_ru','type'=>'text','label'=>'Venue Name','tab' => 'Russian'],
+ ['name'=>'venue_name_tk','type'=>'text','label'=>'Venue Name','tab' => 'Turkmen'],
+ ['name'=>'description_ru','type'=>'text','label'=>'Description', 'tab' => 'Russian'],
+ ['name'=>'description_tk','type'=>'text','label'=>'Description', 'tab' => 'Turkmen'],
[ // Address
'name' => 'address',
'label' => 'Address',
'type' => 'address_google',
// optional
- 'store_as_json' => true
+ 'store_as_json' => true,
+ 'tab' => 'General'
],
+ ['name'=>'images','type'=>'upload_multiple','label'=>'Suratlar',
+ 'upload' => true, 'disk' => config('filesystems.default'), 'tab' => 'Suratlar'],
[ // image
'label' => "Seats Image",
'name' => "seats_image",
'type' => 'image',
'upload' => true,
+ 'tab' => 'Suratlar',
// 'crop' => true, // set to true to allow cropping, false to disable
// 'aspect_ratio' => 1, // ommit or set to 0 to allow any aspect ratio
// 'disk' => 's3_bucket', // in case you need to show images from a different disk
'prefix' => 'user_content/' // in case your db value is only the file name (no path), you can use this to prepend your path to the image src (in HTML), before it's shown to the user;
],
- ['name'=>'active','type'=>'checkbox','label'=>'Active']
+ ['name'=>'active','type'=>'checkbox','label'=>'Active','tab' => 'General']
]);
// add asterisk for fields that are required in VenueRequest
diff --git a/app/Models/Venue.php b/app/Models/Venue.php
index 7dc17874..322d2b78 100644
--- a/app/Models/Venue.php
+++ b/app/Models/Venue.php
@@ -16,7 +16,7 @@ class Venue extends Model
| GLOBAL VARIABLES
|--------------------------------------------------------------------------
*/
- protected $casts = [ 'address' => 'array'];
+ protected $casts = [ 'address' => 'array','images' => 'array'];
protected $table = 'venues';
// protected $primaryKey = 'id';
public $timestamps = false;
@@ -26,6 +26,8 @@ class Venue extends Model
'venue_name_ru',
'venue_name_tk',
'venue_name_full',
+ 'description_ru',
+ 'description_tk',
'location_address',
'location_address_line_1',
'location_address_line_2',
@@ -39,11 +41,13 @@ class Venue extends Model
'location_google_place_id',
'seats_image',
'active',
- 'address'
+ 'address',
+ 'images',
];
// protected $hidden = [];
// protected $dates = [];
+
/*
|--------------------------------------------------------------------------
| FUNCTIONS
@@ -55,6 +59,12 @@ class Venue extends Model
static::deleting(function($obj) {
$disk = config('filesystems.default');
\Storage::disk($disk)->delete($obj->seats_image);
+
+ if (count((array)$obj->images)) {
+ foreach ($obj->images as $file_path) {
+ \Storage::disk('uploads')->delete($file_path);
+ }
+ }
});
}
@@ -122,4 +132,45 @@ class Venue extends Model
$this->attributes[$attribute_name] = $public_destination_path.'/'.$filename;
}
}
+
+ public function uploadMultipleFilesToDisk($value, $attribute_name, $disk, $destination_path)
+ {
+ $request = \Request::instance();
+ $attribute_value = (array) $this->{$attribute_name};
+ $files_to_clear = $request->get('clear_'.$attribute_name);
+ // if a file has been marked for removal,
+ // delete it from the disk and from the db
+ if ($files_to_clear) {
+ $attribute_value = (array) $this->{$attribute_name};
+ foreach ($files_to_clear as $key => $filename) {
+ \Storage::disk($disk)->delete($filename);
+ $attribute_value = array_where($attribute_value, function ($value, $key) use ($filename) {
+ return $value != $filename;
+ });
+ }
+ }
+ // if a new file is uploaded, store it on disk and its filename in the database
+ if ($request->hasFile($attribute_name)) {
+ foreach ($request->file($attribute_name) as $file) {
+ if ($file->isValid()) {
+ // 1. Generate a new file name
+ $new_file_name = $file->getClientOriginalName();
+ // 2. Move the new file to the correct path
+ $file_path = $file->storeAs($destination_path, $new_file_name, $disk);
+ // 3. Add the public path to the database
+ $attribute_value[] = $file_path;
+ }
+ }
+ }
+ $this->attributes[$attribute_name] = json_encode($attribute_value);
+ }
+
+ public function setImagesAttribute($value)
+ {
+ $attribute_name = "images";
+ $disk = config('filesystems.default');
+ $destination_path = "venues/Images";
+
+ $this->uploadMultipleFilesToDisk($value, $attribute_name, $disk, $destination_path);
+ }
}
diff --git a/database/migrations/2020_03_24_190130_alter_add_description_to_venues_table.php b/database/migrations/2020_03_24_190130_alter_add_description_to_venues_table.php
new file mode 100644
index 00000000..78f153c5
--- /dev/null
+++ b/database/migrations/2020_03_24_190130_alter_add_description_to_venues_table.php
@@ -0,0 +1,38 @@
+text('description_ru')->nullable();
+ $table->text('description_tk')->nullable();
+ $table->longText('images')->nullable();
+ $table->string('venue_name')->nullable(true)->change();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('venues', function (Blueprint $table) {
+ $table->dropColumn('description_ru');
+ $table->dropColumn('description_tk');
+ $table->dropColumn('images');
+ $table->string('venue_name')->nullable(false)->change();
+ });
+ }
+}
diff --git a/resources/views/ru/Mailers/TicketMailer/SendOrderTickets.blade.php b/resources/views/ru/Mailers/TicketMailer/SendOrderTickets.blade.php
index c5d2001b..1c8e53af 100644
--- a/resources/views/ru/Mailers/TicketMailer/SendOrderTickets.blade.php
+++ b/resources/views/ru/Mailers/TicketMailer/SendOrderTickets.blade.php
@@ -66,7 +66,7 @@
@if((int)ceil($order_item->unit_price) == 0)
БЕСПЛАТНО
@else
- {{money(($order_item->unit_price) * ($order_item->quantity), $order->event->currency)}}
+ {{money($order_item->unit_total, $order->event->currency)}}
@endif
diff --git a/resources/views/tk/Emails/Layouts/Master.blade.php b/resources/views/tk/Emails/Layouts/Master.blade.php
index ee9eef76..0e92f8be 100644
--- a/resources/views/tk/Emails/Layouts/Master.blade.php
+++ b/resources/views/tk/Emails/Layouts/Master.blade.php
@@ -4,7 +4,7 @@
@section('subject')
- Attendize.com Email
+ Bilettm.com Email
@show
@@ -15,10 +15,10 @@
|
-
+ |
-
+
diff --git a/resources/views/tk/Mailers/TicketMailer/SendOrderTickets.blade.php b/resources/views/tk/Mailers/TicketMailer/SendOrderTickets.blade.php
index 5f71a73e..4c8c29de 100644
--- a/resources/views/tk/Mailers/TicketMailer/SendOrderTickets.blade.php
+++ b/resources/views/tk/Mailers/TicketMailer/SendOrderTickets.blade.php
@@ -1,4 +1,4 @@
-@extends('en.Emails.Layouts.Master')
+@extends('tk.Emails.Layouts.Master')
@section('message_content')
Salam!
@@ -20,7 +20,7 @@ Sargydyň poçtasy: {{$order->email}}
Add To Calendar
Sargydyň petekleri
-
+
Petek
@@ -66,7 +66,7 @@ Sargydyň poçtasy: {{$order->email}}
@if((int)ceil($order_item->unit_price) == 0)
MUGT
@else
- {{money(($order_item->unit_price + $order_item->unit_booking_fee) * ($order_item->quantity), $order->event->currency)}}
+ {{money($order_item->unit_total, $order->event->currency)}}
@endif
|
| |