diff --git a/app/Http/Controllers/EventCustomizeController.php b/app/Http/Controllers/EventCustomizeController.php index 247d16a6..c1e61dc9 100644 --- a/app/Http/Controllers/EventCustomizeController.php +++ b/app/Http/Controllers/EventCustomizeController.php @@ -9,15 +9,16 @@ use Input; use Response; use Validator; use View; +use Illuminate\Http\Request; class EventCustomizeController extends MyBaseController { public function showCustomize($event_id = '', $tab = '') { $data = $this->getEventViewData($event_id, [ - 'available_bg_images' => $this->getAvailableBackgroundImages(), + 'available_bg_images' => $this->getAvailableBackgroundImages(), 'available_bg_images_thumbs' => $this->getAvailableBackgroundImagesThumbs(), - 'tab' => $tab, + 'tab' => $tab, ]); return View::make('ManageEvent.Customize', $data); @@ -27,7 +28,7 @@ class EventCustomizeController extends MyBaseController { $images = []; - $files = File::files(public_path().'/'.config('attendize.event_bg_images')); + $files = File::files(public_path() . '/' . config('attendize.event_bg_images')); foreach ($files as $image) { $images[] = str_replace(public_path(), '', $image); @@ -40,7 +41,7 @@ class EventCustomizeController extends MyBaseController { $images = []; - $files = File::files(public_path().'/'.config('attendize.event_bg_images').'/thumbs'); + $files = File::files(public_path() . '/' . config('attendize.event_bg_images') . '/thumbs'); foreach ($files as $image) { $images[] = str_replace(public_path(), '', $image); @@ -49,28 +50,30 @@ class EventCustomizeController extends MyBaseController return $images; } - public function postEditEventSocial($event_id) + + public function postEditEventTicketSocial($event_id) { $event = Event::scope()->findOrFail($event_id); $rules = [ - 'social_share_text' => ['max:3000'], - 'social_show_facebook' => ['boolean'], - 'social_show_twitter' => ['boolean'], - 'social_show_linkedin' => ['boolean'], - 'social_show_email' => ['boolean'], + 'social_share_text' => ['max:3000'], + 'social_show_facebook' => ['boolean'], + 'social_show_twitter' => ['boolean'], + 'social_show_linkedin' => ['boolean'], + 'social_show_email' => ['boolean'], 'social_show_googleplus' => ['boolean'], ]; + $messages = [ - 'social_share_text.max' => 'Please keep the shate text under 3000 characters.', + 'social_share_text.max' => 'Please keep the shate text under 3000 characters.', ]; $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { return Response::json([ - 'status' => 'error', - 'messages' => $validator->messages()->toArray(), + 'status' => 'error', + 'messages' => $validator->messages()->toArray(), ]); } @@ -83,8 +86,54 @@ class EventCustomizeController extends MyBaseController $event->save(); return Response::json([ - 'status' => 'success', - 'message' => 'Social Settings Succesfully Upated', + 'status' => 'success', + 'message' => 'Social Settings Succesfully Upated', + ]); + + } + + /** + * Update ticket details + * + * @param Request $request + * @param $event_id + * @return mixed + */ + public function postEditEventTicketDesign(Request $request, $event_id) + { + $event = Event::scope()->findOrFail($event_id); + + $rules = [ + //'barcode_type' => ['required'], + 'ticket_border_color' => ['required'], + 'ticket_bg_color' => ['required'], + 'ticket_text_color' => ['required'], + 'ticket_sub_text_color' => ['required'], + ]; + $messages = [ + 'ticket_bg_color.required' => 'Please enter a background color.', + ]; + + $validator = Validator::make($request->all(), $rules, $messages); + + if ($validator->fails()) { + return Response::json([ + 'status' => 'error', + 'messages' => $validator->messages()->toArray(), + ]); + } + + $event->barcode_type = $request->get('barcode_type'); + $event->ticket_border_color = $request->get('ticket_border_color'); + $event->ticket_bg_color = $request->get('ticket_bg_color'); + $event->ticket_text_color = $request->get('ticket_text_color'); + $event->ticket_sub_text_color = $request->get('ticket_sub_text_color'); + + $event->save(); + + return response()->json([ + 'status' => 'success', + 'message' => 'Ticket Settings Updated', ]); } @@ -94,20 +143,20 @@ class EventCustomizeController extends MyBaseController $rules = [ 'organiser_fee_percentage' => ['numeric', 'between:0,100'], - 'organiser_fee_fixed' => ['numeric', 'between:0,100'], + 'organiser_fee_fixed' => ['numeric', 'between:0,100'], ]; $messages = [ - 'organiser_fee_percentage.numeric' => 'Please enter a value between 0 and 100', - 'organiser_fee_fixed.numeric' => 'Please check the format. It shoud be in the format 0.00.', - 'organiser_fee_fixed.between' => 'Please enter a value between 0 and 100.', + 'organiser_fee_percentage.numeric' => 'Please enter a value between 0 and 100', + 'organiser_fee_fixed.numeric' => 'Please check the format. It shoud be in the format 0.00.', + 'organiser_fee_fixed.between' => 'Please enter a value between 0 and 100.', ]; $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { return Response::json([ - 'status' => 'error', - 'messages' => $validator->messages()->toArray(), + 'status' => 'error', + 'messages' => $validator->messages()->toArray(), ]); } @@ -116,8 +165,8 @@ class EventCustomizeController extends MyBaseController $event->save(); return Response::json([ - 'status' => 'success', - 'message' => 'Order Page Succesfully Upated', + 'status' => 'success', + 'message' => 'Order Page Succesfully Upated', ]); } @@ -133,8 +182,8 @@ class EventCustomizeController extends MyBaseController if ($validator->fails()) { return Response::json([ - 'status' => 'error', - 'messages' => $validator->messages()->toArray(), + 'status' => 'error', + 'messages' => $validator->messages()->toArray(), ]); } @@ -144,8 +193,8 @@ class EventCustomizeController extends MyBaseController $event->save(); return Response::json([ - 'status' => 'success', - 'message' => 'Order Page Succesfully Upated', + 'status' => 'success', + 'message' => 'Order Page Successfully Upated', ]); } @@ -158,15 +207,15 @@ class EventCustomizeController extends MyBaseController ]; $messages = [ 'bg_image_path.mimes' => 'Please ensure you are uploading an image (JPG, PNG, JPEG)', - 'bg_image_path.max' => 'Pleae ensure the image is not larger than 2.5MB', + 'bg_image_path.max' => 'Please ensure the image is not larger than 2.5MB', ]; $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { return Response::json([ - 'status' => 'error', - 'messages' => $validator->messages()->toArray(), + 'status' => 'error', + 'messages' => $validator->messages()->toArray(), ]); } @@ -184,10 +233,10 @@ class EventCustomizeController extends MyBaseController * Not in use for now. */ if (Input::hasFile('bg_image_path') && Input::get('bg_type') == 'custom_image') { - $path = public_path().'/'.config('attendize.event_images_path'); - $filename = 'event_bg-'.md5($event->id).'.'.strtolower(Input::file('bg_image_path')->getClientOriginalExtension()); + $path = public_path() . '/' . config('attendize.event_images_path'); + $filename = 'event_bg-' . md5($event->id) . '.' . strtolower(Input::file('bg_image_path')->getClientOriginalExtension()); - $file_full_path = $path.'/'.$filename; + $file_full_path = $path . '/' . $filename; Input::file('bg_image_path')->move($path, $filename); @@ -200,18 +249,18 @@ class EventCustomizeController extends MyBaseController $img->save($file_full_path, 75); - $event->bg_image_path = config('attendize.event_images_path').'/'.$filename; + $event->bg_image_path = config('attendize.event_images_path') . '/' . $filename; $event->bg_type = 'custom_image'; - \Storage::put(config('attendize.event_images_path').'/'.$filename, file_get_contents($file_full_path)); + \Storage::put(config('attendize.event_images_path') . '/' . $filename, file_get_contents($file_full_path)); } $event->save(); return Response::json([ - 'status' => 'success', - 'message' => 'Event Page Succesfully Upated', - 'runThis' => 'document.getElementById(\'previewIframe\').contentWindow.location.reload(true);', + 'status' => 'success', + 'message' => 'Event Page Succesfully Upated', + 'runThis' => 'document.getElementById(\'previewIframe\').contentWindow.location.reload(true);', ]); } } diff --git a/app/Http/Controllers/OrganiserCustomizeController.php b/app/Http/Controllers/OrganiserCustomizeController.php index 904307ef..e3bd90a0 100644 --- a/app/Http/Controllers/OrganiserCustomizeController.php +++ b/app/Http/Controllers/OrganiserCustomizeController.php @@ -54,7 +54,7 @@ class OrganiserCustomizeController extends MyBaseController $file_name = str_slug($organiser->name).'-logo-'.$organiser->id.'.'.strtolower(Input::file('organiser_logo')->getClientOriginalExtension()); $relative_path_to_file = config('attendize.organiser_images_path').'/'.$file_name; - $full_path_to_file = public_path().'/'.$relative_path_to_file; + $full_path_to_file = public_path($relative_path_to_file); $img = Image::make($the_file); diff --git a/app/Http/routes.php b/app/Http/routes.php index 51af7b93..7d5df373 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -532,6 +532,10 @@ Route::group(['middleware' => ['auth', 'first.run']], function () { 'as' => 'postEditEventDesign', 'uses' => 'EventCustomizeController@postEditEventDesign', ]); + Route::post('{event_id}/customize/ticket_design', [ + 'as' => 'postEditEventTicketDesign', + 'uses' => 'EventCustomizeController@postEditEventTicketDesign', + ]); Route::post('{event_id}/customize/social', [ 'as' => 'postEditEventSocial', 'uses' => 'EventCustomizeController@postEditEventSocial', diff --git a/config/attendize.php b/config/attendize.php index f528a289..d43610f8 100644 --- a/config/attendize.php +++ b/config/attendize.php @@ -26,9 +26,9 @@ return [ 'app_name' => 'Attendize Event Ticketing', 'event_default_bg_color' => '#B23333', - 'event_images_path' => 'user_content/event_images/', - 'organiser_images_path' => 'user_content/organiser_images/', - 'event_pdf_tickets_path' => 'user_content/pdf_tickets/', + 'event_images_path' => 'user_content/event_images', + 'organiser_images_path' => 'user_content/organiser_images', + 'event_pdf_tickets_path' => 'user_content/pdf_tickets', 'event_bg_images' => 'assets/images/public/EventPage/backgrounds', 'fallback_organiser_logo_url' => '/assets/images/logo-100x100-lightBg.png', diff --git a/database/migrations/2016_03_09_221103_add_ticket_design_options.php b/database/migrations/2016_03_09_221103_add_ticket_design_options.php new file mode 100644 index 00000000..ed959332 --- /dev/null +++ b/database/migrations/2016_03_09_221103_add_ticket_design_options.php @@ -0,0 +1,44 @@ +string('barcode_type', 10)->default('QRCODE'); + $table->string('ticket_border_color', 10)->default('#000000'); + $table->string('ticket_bg_color', 10)->default('#FFFFFF'); + $table->string('ticket_text_color', 10)->default('#000000'); + $table->string('ticket_sub_text_color', 10)->default('#999999'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('events', function (Blueprint $table) { + $table->dropColumn([ + 'barcode_type', + 'ticket_border_color', + 'ticket_bg_color', + 'ticket_text_color', + 'ticket_sub_text_color' + ]); + }); + } +} diff --git a/resources/views/ManageEvent/Customize.blade.php b/resources/views/ManageEvent/Customize.blade.php index 69517f87..f665f531 100644 --- a/resources/views/ManageEvent/Customize.blade.php +++ b/resources/views/ManageEvent/Customize.blade.php @@ -179,6 +179,8 @@ data-toggle="tab">Affiliates