mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-10-19 09:03:35 -04:00
1756 lines
86 KiB
PHP
1756 lines
86 KiB
PHP
<?php
|
|
namespace Modules\StaffPortal\Services;
|
|
use File;
|
|
|
|
class AugmentationService
|
|
{
|
|
public function __construct() {
|
|
$this->addLoginTab();
|
|
$this->addLoginTabForm();
|
|
$this->updateSidebar();
|
|
$this->hidePlusMenuForStaff();
|
|
$this->addTooltipsToMenus();
|
|
$this->fixStaffSidebarMenuOrder();
|
|
$this->updateCreateDashboardColorPickers();
|
|
$this->updateEditDashboardColorPickers();
|
|
|
|
if (isModuleActive('JobPortal')) {
|
|
$this->updateDashboard();
|
|
$this->addMainMenuToAdminDashboard();
|
|
$this->addMenuColorSettings();
|
|
$this->updateProfileMenu();
|
|
}
|
|
|
|
$this->addUsernameFieldToStaffCreateForm();
|
|
$this->addUsernameFieldToStaffEditForm();
|
|
$this->updateUserRepository();
|
|
$this->updateStaffRequest();
|
|
$this->updateLoginController();
|
|
//$this->addMobileHeaderForStaffLogin();
|
|
$this->updateRegisterController();
|
|
$this->addUsernameSupportToProfilePage();
|
|
$this->updateUsernameSupportInCustomerController();
|
|
$this->addUsernameFieldToCandidateProfileForm();
|
|
$this->updateUsernameSupportInCandidateProfileController();
|
|
$this->addFrontendProfileMenu();
|
|
|
|
$this->copyLangFile();
|
|
$this->addUsernameFieldToStaffRegister();
|
|
|
|
$this->updateUserModel();
|
|
$this->addJobPortalMenu();
|
|
$this->addEmailSettingsToGeneralSettings();
|
|
|
|
$this->updateCustomerDetails();
|
|
}
|
|
|
|
public static function addLoginTab() {
|
|
if (isModuleActive('FrontendCMS')) {
|
|
$path = module_path('FrontendCMS', 'Resources/views/login-page/index.blade.php');
|
|
if (file_exists($path)) {
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/@include\('staffportal::components\._login_tab'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@if\(isModuleActive\('MultiVendor'\)\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components._login_tab')
|
|
@endif
|
|
";
|
|
$code = $snippet.$code;
|
|
$content = preg_replace("/@if\(isModuleActive\('MultiVendor'\)\)/", $code, $content);
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public static function addLoginTabForm() {
|
|
if (isModuleActive('FrontendCMS')) {
|
|
$path = module_path('FrontendCMS', 'Resources/views/login-page/components/form.blade.php');
|
|
if (file_exists($path)) {
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/@include\('staffportal::components\._login_tab_form'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match('/<div role="tabpanel" class="tab-pane fade {{ \$loginPageTab == 3\?\'active show\':\'\' }} " id="seller">/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components._login_tab_form')
|
|
@endif
|
|
";
|
|
$code = $snippet.$code;
|
|
$content = preg_replace('/<div role="tabpanel" class="tab-pane fade {{ \$loginPageTab == 3\?\'active show\':\'\' }} " id="seller">/', $code, $content);
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public function updateSidebar() {
|
|
//$theme = app('theme');
|
|
//if ($theme) {
|
|
//$theme_name = app('theme')->folder_path;
|
|
$path = resource_path('views/backEnd/partials/_sidebar.blade.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/FEMD/", $content)) {
|
|
$matches = null;
|
|
preg_match('/<span class="menu_seperator">[.\s\S]+?<\/span>/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
{{-- FEMD --}}
|
|
@php
|
|
\$count = 0;
|
|
@endphp
|
|
@if(\$section->children->count())
|
|
@foreach(\$section->children as \$menu)
|
|
@if(!@\$menu->backendMenu->module or isModuleActive(@\$menu->backendMenu->module))
|
|
@if(@\$menu->backendMenu->route == 'payment_gateway.index' && auth()->user()->role->type == 'seller' && !app('general_setting')->seller_wise_payment)
|
|
@continue
|
|
@elseif(permissionCheck(@\$menu->backendMenu->route))
|
|
@php
|
|
\$count++;
|
|
@endphp
|
|
@endif
|
|
@endif
|
|
@endforeach
|
|
@endif
|
|
|
|
@if(\$count > 0)
|
|
"
|
|
.$code.
|
|
"
|
|
@endif
|
|
";
|
|
$code = $snippet;
|
|
$content = preg_replace('/<span class="menu_seperator">[.\s\S]+?<\/span>/', $code, $content);
|
|
//file_put_contents($path, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
//}
|
|
}
|
|
|
|
public function updateDashboard() {
|
|
//$theme = app('theme');
|
|
//if ($theme) {
|
|
//$theme_name = app('theme')->folder_path;
|
|
$path = resource_path('views/backEnd/dashboard.blade.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/@include\('staffportal::components\._dashboard_cards'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match('/@if \(permissionCheck\(\'widget_card\'\)\)[\r\n]*[\s]+?<div class="row mb_30">/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components._dashboard_cards')
|
|
@endif
|
|
";
|
|
$code = $snippet.$code;
|
|
$content = preg_replace('/@if \(permissionCheck\(\'widget_card\'\)\)[\r\n]*[\s]+?<div class="row mb_30">/', $code, $content);
|
|
//file_put_contents($path, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
//}
|
|
}
|
|
|
|
public function addMainMenuToAdminDashboard() {
|
|
//$theme = app('theme');
|
|
//if ($theme) {
|
|
//$theme_name = app('theme')->folder_path;
|
|
$path = resource_path('views/backEnd/master.blade.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/@include\('staffportal::components\._mega_menu'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@include\('backEnd\.partials\._menu'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components._mega_menu')
|
|
@endif
|
|
";
|
|
$code = $snippet.$code;
|
|
$content = preg_replace("/@include\('backEnd\.partials\._menu'\)/", $code, $content);
|
|
//file_put_contents($path, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
//}
|
|
}
|
|
|
|
public static function addMenuColorSettings() {
|
|
if (isModuleActive('Appearance')) {
|
|
$path = module_path('Appearance', 'Resources/views/theme_color/index.blade.php');
|
|
if (file_exists($path)) {
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/@include\('staffportal::components\._color_settings'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('danger_color'\)[.\s\S]+?<\/div>[.\s\S]+?<\/div>/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components._color_settings')
|
|
@endif
|
|
";
|
|
$code .= $snippet;
|
|
$content = preg_replace("/@error\('danger_color'\)[.\s\S]+?<\/div>[.\s\S]+?<\/div>/", $code, $content);
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public function updateProfileMenu() {
|
|
$path = resource_path('views/backEnd/partials/_menu.blade.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/@if \(isModuleActive\('StaffPortal'\)[.\s\S]+?'staff'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match('/<a href="{{url\(\'\/profile\'\)}}">{{__[.\s\S]+?<\/a>/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal') && auth()->user()->role->type == 'staff')
|
|
<a href=\"{{route('user.candidate.index')}}\">{{__('customer_panel.my_profile')}}<i class=\"ti-user\"></i></a>
|
|
@else
|
|
<a href=\"{{url('/profile')}}\">{{__('customer_panel.my_profile')}}<i class=\"ti-user\"></i></a>
|
|
@endif
|
|
";
|
|
$code = $snippet;
|
|
$content = preg_replace('/<a href="{{url\(\'\/profile\'\)}}">{{__[.\s\S]+?<\/a>/', $code, $content);
|
|
//file_put_contents($path, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function hidePlusMenuForStaff() {
|
|
$path = resource_path('views/backEnd/partials/_menu.blade.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/@if.+'affiliate'.+'customer'.+'staff'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@if.+'affiliate'.+'customer'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if(auth()->user()->role->type != 'affiliate' && auth()->user()->role->type != 'customer' && auth()->user()->role->type != 'staff')
|
|
";
|
|
$code = $snippet;
|
|
$content = preg_replace("/@if.+'affiliate'.+'customer'\)/", $code, $content);
|
|
//file_put_contents($path, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function addTooltipsToMenus() {
|
|
$path = resource_path('views/backEnd/partials/_menu.blade.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match('/<i class="fas fa-plus-square" title="Notification Warp"><\/i>/', $content)) {
|
|
$matches = null;
|
|
preg_match('/<i class="fas fa-plus-square"><\/i>/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
<i class=\"fas fa-plus-square\" title=\"Notification Warp\"></i>
|
|
";
|
|
$code = $snippet;
|
|
$content = preg_replace('/<i class="fas fa-plus-square"><\/i>/', $code, $content);
|
|
//file_put_contents($path, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match('/<i class="fa fa-bell" title="Notifications"><\/i>/', $content)) {
|
|
$matches = null;
|
|
preg_match('/<i class="fa fa-bell"><\/i>/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components._tooltips_script')
|
|
@endif
|
|
<i class=\"fa fa-bell\" title=\"Notifications\"></i>
|
|
";
|
|
$code = $snippet;
|
|
$content = preg_replace('/<i class="fa fa-bell"><\/i>/', $code, $content);
|
|
//file_put_contents($path, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
|
|
public static function fixStaffSidebarMenuOrder() {
|
|
if (isModuleActive('SidebarManager')) {
|
|
$path = module_path('SidebarManager', 'Traits/SidebarTrait.php');
|
|
if (file_exists($path)) {
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/isModuleActive\('StaffPortal'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match('/foreach\(\$backend_menu_not_exsist as \$menu\){[.\s\S]+?BackendmenuUser::create[.\s\S]+?}/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
if (isModuleActive('StaffPortal')) {
|
|
\Modules\StaffPortal\Services\CommonService::processMenus(\$backend_menu_not_exsist);
|
|
}
|
|
/*
|
|
".$code."
|
|
*/
|
|
";
|
|
$code = $snippet;
|
|
$content = preg_replace('/foreach\(\$backend_menu_not_exsist as \$menu\){[.\s\S]+?BackendmenuUser::create[.\s\S]+?}/', $code, $content);
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public function updateCreateDashboardColorPickers() {
|
|
if (isModuleActive('Appearance')) {
|
|
$path = module_path('Appearance', 'Resources/views/color/create.blade.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match('/\.color-picker-container/', $content)) {
|
|
$matches = null;
|
|
preg_match('/<link rel="stylesheet" href="{{ asset\(asset_path\(\'backend\/vendors\/vendors_style\.css\'\)\) }}" \/>/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/@simonwep/pickr/dist/themes/nano.min.css\"/>
|
|
|
|
<style>
|
|
.pcr-app .pcr-interaction .pcr-type.active {
|
|
background: #4285f4 !important;
|
|
}
|
|
.pickr .pcr-button {
|
|
width: 100%;
|
|
}
|
|
.color-picker-container {
|
|
padding: 0 3px 3px 3px;
|
|
border: 1px solid #555;
|
|
border-radius: 3px;
|
|
}
|
|
</style>
|
|
";
|
|
$code .= $snippet;
|
|
$content = preg_replace('/<link rel="stylesheet" href="{{ asset\(asset_path\(\'backend\/vendors\/vendors_style\.css\'\)\) }}" \/>/', $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._background_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('background_color'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components.dashboard_pickers._background_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('background_color'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._base_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('base_color'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components.dashboard_pickers._base_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('base_color'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._solid_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('solid_color'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components.dashboard_pickers._solid_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('solid_color'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._gradient_one_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('gradient_color_one'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components.dashboard_pickers._gradient_one_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('gradient_color_one'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._gradient_two_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('gradient_color_two'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components.dashboard_pickers._gradient_two_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('gradient_color_two'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._gradient_three_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('gradient_color_three'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components.dashboard_pickers._gradient_three_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('gradient_color_three'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._scroll_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('scroll_color'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components.dashboard_pickers._scroll_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('scroll_color'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._text_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('text_color'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components.dashboard_pickers._text_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('text_color'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._text_white_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('text_white'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components.dashboard_pickers._text_white_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('text_white'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._background_white_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('background_white'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components.dashboard_pickers._background_white_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('background_white'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._text_black_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('text_black'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components.dashboard_pickers._text_black_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('text_black'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._background_black_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('background_black'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components.dashboard_pickers._background_black_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('background_black'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._border_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('border_color'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components.dashboard_pickers._border_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('border_color'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._input_background_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('input_background'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components.dashboard_pickers._input_background_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('input_background'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._success_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('success_color'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components.dashboard_pickers._success_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('success_color'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._warning_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('warning_color'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components.dashboard_pickers._warning_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('warning_color'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._danger_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('danger_color'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components.dashboard_pickers._danger_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('danger_color'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._script'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@endpush/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components.dashboard_pickers._script')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@endpush/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/primary_input_field d-none/", $content)) {
|
|
$matches = null;
|
|
preg_match("/primary_input_field/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "primary_input_field d-none";
|
|
$code = $snippet;
|
|
$content = preg_replace("/primary_input_field/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match('/id="title" class="primary_input_field"/', $content)) {
|
|
$matches = null;
|
|
preg_match('/id="title" class="primary_input_field d-none"/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = 'id="title" class="primary_input_field"';
|
|
$code = $snippet;
|
|
$content = preg_replace('/id="title" class="primary_input_field d-none"/', $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match('/class="primary_input_field" type="number" id="toastr_time"/', $content)) {
|
|
$matches = null;
|
|
preg_match('/class="primary_input_field d-none" type="number" id="toastr_time"/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = 'class="primary_input_field" type="number" id="toastr_time"';
|
|
$code = $snippet;
|
|
$content = preg_replace('/class="primary_input_field d-none" type="number" id="toastr_time"/', $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public function updateEditDashboardColorPickers() {
|
|
if (isModuleActive('Appearance')) {
|
|
$path = module_path('Appearance', 'Resources/views/color/edit.blade.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match('/\.color-picker-container/', $content)) {
|
|
$matches = null;
|
|
preg_match('/<link rel="stylesheet" href="{{ asset\(asset_path\(\'backend\/vendors\/vendors_style\.css\'\)\) }}" \/>/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/@simonwep/pickr/dist/themes/nano.min.css\"/>
|
|
|
|
<style>
|
|
.pcr-app .pcr-interaction .pcr-type.active {
|
|
background: #4285f4 !important;
|
|
}
|
|
.pickr .pcr-button {
|
|
width: 100%;
|
|
}
|
|
.color-picker-container {
|
|
padding: 0 3px 3px 3px;
|
|
border: 1px solid #555;
|
|
border-radius: 3px;
|
|
}
|
|
</style>
|
|
";
|
|
$code .= $snippet;
|
|
$content = preg_replace('/<link rel="stylesheet" href="{{ asset\(asset_path\(\'backend\/vendors\/vendors_style\.css\'\)\) }}" \/>/', $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._background_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('background_color'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('staffportal'))
|
|
@include('staffportal::components.dashboard_pickers._background_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('background_color'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._base_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('base_color'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('staffportal'))
|
|
@include('staffportal::components.dashboard_pickers._base_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('base_color'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._solid_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('solid_color'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('staffportal'))
|
|
@include('staffportal::components.dashboard_pickers._solid_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('solid_color'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._gradient_one_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('gradient_color_one'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('staffportal'))
|
|
@include('staffportal::components.dashboard_pickers._gradient_one_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('gradient_color_one'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._gradient_two_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('gradient_color_two'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('staffportal'))
|
|
@include('staffportal::components.dashboard_pickers._gradient_two_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('gradient_color_two'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._gradient_three_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('gradient_color_three'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('staffportal'))
|
|
@include('staffportal::components.dashboard_pickers._gradient_three_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('gradient_color_three'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._scroll_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('scroll_color'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('staffportal'))
|
|
@include('staffportal::components.dashboard_pickers._scroll_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('scroll_color'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._text_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('text_color'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('staffportal'))
|
|
@include('staffportal::components.dashboard_pickers._text_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('text_color'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._text_white_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('text_white'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('staffportal'))
|
|
@include('staffportal::components.dashboard_pickers._text_white_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('text_white'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._background_white_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('background_white'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('staffportal'))
|
|
@include('staffportal::components.dashboard_pickers._background_white_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('background_white'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._text_black_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('text_black'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('staffportal'))
|
|
@include('staffportal::components.dashboard_pickers._text_black_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('text_black'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._background_black_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('background_black'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('staffportal'))
|
|
@include('staffportal::components.dashboard_pickers._background_black_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('background_black'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._border_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('border_color'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('staffportal'))
|
|
@include('staffportal::components.dashboard_pickers._border_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('border_color'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._input_background_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('input_background'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('staffportal'))
|
|
@include('staffportal::components.dashboard_pickers._input_background_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('input_background'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._success_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('success_color'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('staffportal'))
|
|
@include('staffportal::components.dashboard_pickers._success_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('success_color'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._warning_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('warning_color'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('staffportal'))
|
|
@include('staffportal::components.dashboard_pickers._warning_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('warning_color'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._danger_color_picker'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@error\('danger_color'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('staffportal'))
|
|
@include('staffportal::components.dashboard_pickers._danger_color_picker')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@error\('danger_color'\)/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\.dashboard_pickers._script'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/@endpush/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('staffportal'))
|
|
@include('staffportal::components.dashboard_pickers._script')
|
|
@endif
|
|
";
|
|
$code = $snippet . $code;
|
|
$content = preg_replace("/@endpush/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/primary_input_field d-none/", $content)) {
|
|
$matches = null;
|
|
preg_match("/primary_input_field/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "primary_input_field d-none";
|
|
$code = $snippet;
|
|
$content = preg_replace("/primary_input_field/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match('/id="title" class="primary_input_field"/', $content)) {
|
|
$matches = null;
|
|
preg_match('/id="title" class="primary_input_field d-none"/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = 'id="title" class="primary_input_field"';
|
|
$code = $snippet;
|
|
$content = preg_replace('/id="title" class="primary_input_field d-none"/', $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match('/class="primary_input_field" type="number" id="toastr_time"/', $content)) {
|
|
$matches = null;
|
|
preg_match('/class="primary_input_field d-none" type="number" id="toastr_time"/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = 'class="primary_input_field" type="number" id="toastr_time"';
|
|
$code = $snippet;
|
|
$content = preg_replace('/class="primary_input_field d-none" type="number" id="toastr_time"/', $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public function addUsernameFieldToStaffCreateForm() {
|
|
$path = resource_path('views/backEnd/staffs/create.blade.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/\@include\('staffportal::components\._username_field'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match('/<span class="text-danger">{{\$errors->first\(\'phone\'\)}}<\/span>[.\s\S]+?<\/div>[.\s\S]+?<\/div>/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components._username_field')
|
|
@endif
|
|
";
|
|
$code = $code.$snippet;
|
|
$content = preg_replace('/<span class="text-danger">{{\$errors->first\(\'phone\'\)}}<\/span>[.\s\S]+?<\/div>[.\s\S]+?<\/div>/', $code, $content);
|
|
//file_put_contents($path, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function addUsernameFieldToStaffEditForm() {
|
|
$path = resource_path('views/backEnd/staffs/edit.blade.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/\@include\('staffportal::components\._username_field'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match('/<span class="text-danger">{{\$errors->first\(\'phone\'\)}}<\/span>[.\s\S]+?<\/div>[.\s\S]+?<\/div>/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components._username_field')
|
|
@endif
|
|
";
|
|
$code = $code.$snippet;
|
|
$content = preg_replace('/<span class="text-danger">{{\$errors->first\(\'phone\'\)}}<\/span>[.\s\S]+?<\/div>[.\s\S]+?<\/div>/', $code, $content);
|
|
//file_put_contents($path, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function updateUserRepository() {
|
|
$path = app_path('Repositories/UserRepository.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match('/\(isModuleActive\(\'StaffPortal\'\)\)/', $content)) {
|
|
$matches = null;
|
|
preg_match('/\$user->username = \$data\[\'phone\'\];/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
if (isModuleActive('StaffPortal')) {
|
|
\$user->phone = \$data['phone'];
|
|
\$user->username = \$data['username'];
|
|
}
|
|
";
|
|
$code = $code.$snippet;
|
|
$content = preg_replace('/\$user->username = \$data\[\'phone\'\];/', $code, $content);
|
|
//file_put_contents($path, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function updateStaffRequest() {
|
|
$path = app_path('Http/Requests/StaffRequest.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match('/\(isModuleActive\(\'StaffPortal\'\)\)/', $content)) {
|
|
$matches = null;
|
|
preg_match('/"phone" => "nullable\|unique:users,username,"\.\$request->user_id,/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
\"phone\" => \"nullable|unique:users,phone,\".\\\$request->user_id,
|
|
\"username\" => \"required|unique:users,username,\".\\\$request->user_id,
|
|
";
|
|
$code = $snippet;
|
|
$content = preg_replace('/"phone" => "nullable\|unique:users,username,"\.\$request->user_id,/', $code, $content);
|
|
//file_put_contents($path, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function updateLoginController() {
|
|
$path = app_path('Http/Controllers/Auth/LoginController.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/\\\$q->where\('type', 'customer'\)->orWhere\('type', 'staff'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/\\\$q->where\('type', 'customer'\)/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "\$q->where('type', 'customer')->orWhere('type', 'staff')";
|
|
$code = $snippet;
|
|
$content = preg_replace("/\\\$q->where\('type', 'customer'\)/", $code, $content);
|
|
//file_put_contents($path, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function addMobileHeaderForStaffLogin() {
|
|
$path = resource_path('views/frontend/amazy/partials/_header.blade.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/@include\('staffportal::components\._mobile_header'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match("/<!-- HEADER::START -->/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components._mobile_header')
|
|
@endif
|
|
";
|
|
$code .= $snippet;
|
|
$content = preg_replace("/<!-- HEADER::START -->/", $code, $content);
|
|
//file_put_contents($path, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function updateRegisterController() {
|
|
$path = app_path('Http/Controllers/Auth/RegisterController.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match('/\(isModuleActive\(\'StaffPortal\'\)\)/', $content)) {
|
|
$matches = null;
|
|
preg_match("/return view\(theme\('auth\.register'\),compact\('row','form_data','loginPageInfo'\)\);/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
if (isModuleActive('StaffPortal')) {
|
|
return view('staffportal::register', compact('row', 'form_data', 'loginPageInfo'));
|
|
}
|
|
else {
|
|
return view(theme('auth.register'),compact('row','form_data','loginPageInfo'));
|
|
}
|
|
";
|
|
$code = $snippet;
|
|
$content = preg_replace("/return view\(theme\('auth\.register'\),compact\('row','form_data','loginPageInfo'\)\);/", $code, $content);
|
|
//file_put_contents($path, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
|
|
if (!preg_match('/function create[.\s\S]+?\$user->job_category_data/', $content)) {
|
|
$matches = null;
|
|
preg_match("/function create\([.\s\S]+?if\(isModuleActive\('WTISignupForms'\)\)\{[.\s\S]+?data\['job_type'\]\;/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
|
|
if(isModuleActive('StaffPortal')){
|
|
|
|
//POV VIDEOS FORM
|
|
if(\$data['job_type'] == 17) {
|
|
\$user->job_category_data = \$data->only('asin', 'video_creator', 'shipping_info', 'tracking_info', 'product_received', 'video_published');
|
|
} else if(\$data['job_type'] == 25) {
|
|
\$user->job_category_data = \$data->only('asin', 'pov_video_link', 'date_scheduled', 'livestream_completed');
|
|
}
|
|
|
|
}
|
|
|
|
\$user->company_id = isset(\$company) ? \$company->id : null;
|
|
";
|
|
$code = $code.$snippet;
|
|
$content = preg_replace("/function create\([.\s\S]+?if\(isModuleActive\('WTISignupForms'\)\)\{[.\s\S]+?data\['job_type'\]\;/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/function create\([.\s\S]+?if\(isModuleActive\('WTISignupForms'\)\)\{[.\s\S]+?if\(isModuleActive\('StaffPortal'\)\)\{[.\s\S]+?data\['job_type'\] \=\= 17\) {[.\s\S]+?\$data\[\'asin\'\]/", $content)) {
|
|
$matches = null;
|
|
preg_match("/function create\([.\s\S]+?if\(isModuleActive\('WTISignupForms'\)\)\{[.\s\S]+?if\(isModuleActive\('StaffPortal'\)\)\{[.\s\S]+?data\['job_type'\] \=\= 17\) {[.\s\S]+?}/", $content, $matches);
|
|
|
|
if (count($matches) > 0) {
|
|
$code = str_replace("\$user->job_category_data = \$data->only('asin', 'video_creator', 'shipping_info', 'tracking_info', 'product_received', 'video_published');", "
|
|
\$data['asin'] = explode(',', \$data['pov_asin']);
|
|
\$user->job_category_data = \$data->only('asin', 'video_creator', 'shipping_info', 'tracking_info', 'product_received', 'video_published');",$matches[0]);
|
|
|
|
$content = preg_replace("/function create\([.\s\S]+?if\(isModuleActive\('WTISignupForms'\)\)\{[.\s\S]+?if\(isModuleActive\('StaffPortal'\)\)\{[.\s\S]+?data\['job_type'\] \=\= 17\) {[.\s\S]+?}/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match('/function create[.\s\S]+?\$data\[\'product_names\'\]/', $content)) {
|
|
$matches = null;
|
|
preg_match("/function create\([.\s\S]+?if\(isModuleActive\('WTISignupForms'\)\)\{[.\s\S]+?if\(isModuleActive\('StaffPortal'\)\)\{[.\s\S]+?data\['job_type'\] \=\= 25\) {[.\s\S]+?}/", $content, $matches);
|
|
|
|
if (count($matches) > 0) {
|
|
$code = str_replace("\$user->job_category_data = \$data->only('asin', 'pov_video_link', 'date_scheduled', 'livestream_completed');", "
|
|
\$data['asin'] = explode(',', \$data['livestream_asin']);
|
|
\$data['product_names'] = preg_split ('/\\r\\n|\\r|\\n/', \$data['product_names']);
|
|
|
|
if(\$file = \$data->file('brand_logo')){
|
|
\$brand_logo = ImageStore::saveImage(\$file);
|
|
\$data['sponsored_logo'] = \$brand_logo;
|
|
}
|
|
|
|
\$user->job_category_data = \$data->only('sponsored_live_shows','sponsored_asin','sponsored_logo','featured_total','asin','product_names','featured_item','pov_video_asin', 'pov_video_link', 'date_scheduled', 'livestream_completed');",$matches[0]);
|
|
|
|
$content = preg_replace("/function create\([.\s\S]+?if\(isModuleActive\('WTISignupForms'\)\)\{[.\s\S]+?if\(isModuleActive\('StaffPortal'\)\)\{[.\s\S]+?data\['job_type'\] \=\= 25\) {[.\s\S]+?}/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/Company\:\:create\(/", $content)) {
|
|
$matches = null;
|
|
preg_match('/[.\s\S]+function create\([.\s\S]+?{[.\s\S]+?referral_code[.\s\S]+?}[.\s\S]+?}/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "\n\n\t\tif(isModuleActive('JobPortal') && \$role_id == 4){ \n\n\t\t\t\$company = \Modules\JobPortal\Entities\Company::create([\n\t\t\t\t'name' => \$data['company'],\n\t\t\t\t'owner_id' => \$user->id,\n\t\t\t\t'email' => \$data['email'],\n\t\t\t\t'phone' => \$data['[phone]'],\n\t\t\t\t'website' => \$data['website']\n\t\t\t]); \n\n\t\t}\n\n";
|
|
$code .= $snippet;
|
|
$content = preg_replace("/[.\s\S]+function create\([.\s\S]+?{[.\s\S]+?referral_code[.\s\S]+?}[.\s\S]+?}/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/function create[.\s\S]+?\$user->company_name \=/", $content)) {
|
|
$matches = null;
|
|
preg_match("/function create\([.\s\S]+?if\(isModuleActive\('WTISignupForms'\)\)\{[.\s\S]+?company \=/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = str_replace("\$user->company =", "\$user->company_name =",$matches[0]);
|
|
$content = preg_replace("/function create\([.\s\S]+?if\(isModuleActive\('WTISignupForms'\)\)\{[.\s\S]+?company \=/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function addUsernameSupportToProfilePage() {
|
|
$path = resource_path('views/backEnd/pages/customer_data/profile.blade.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/\@include\('staffportal::components\._username_field2'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match('/<span class="text-danger" id="error_phone"><\/span>[.\s\S]+?<\/div>[.\s\S]+?<\/div>/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components._username_field2')
|
|
@endif
|
|
";
|
|
$code = $code.$snippet;
|
|
$content = preg_replace('/<span class="text-danger" id="error_phone"><\/span>[.\s\S]+?<\/div>[.\s\S]+?<\/div>/', $code, $content);
|
|
//file_put_contents($path, $content);
|
|
$update = true;
|
|
}
|
|
|
|
$matches = null;
|
|
preg_match("/\\\$\('#error_avatar'\)\.text\(response\.responseJSON\.errors\.avatar\);/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
$('#error_username').text(response.responseJSON.errors.username);
|
|
@endif
|
|
";
|
|
$code = $code.$snippet;
|
|
$content = preg_replace("/\\\$\('#error_avatar'\)\.text\(response\.responseJSON\.errors\.avatar\);/", $code, $content);
|
|
//file_put_contents($path, $content);
|
|
$update = true;
|
|
}
|
|
|
|
$matches = null;
|
|
preg_match("/\\\$\('#error_avatar'\)\.text\(''\);/", $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
$('#error_username').text('');
|
|
@endif
|
|
";
|
|
$code = $code.$snippet;
|
|
$content = preg_replace("/\\\$\('#error_avatar'\)\.text\(''\);/", $code, $content);
|
|
//file_put_contents($path, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
|
|
public static function updateUsernameSupportInCustomerController() {
|
|
if (isModuleActive('Customer')) {
|
|
$path = module_path('Customer', 'Http/Controllers/CustomerController.php');
|
|
if (file_exists($path)) {
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/isModuleActive\('StaffPortal'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match('/public function updateInfo\(Request \$request\)[.\s\S]+?{/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
if (isModuleActive('StaffPortal')) {
|
|
\$ret = app(\Modules\StaffPortal\Services\CommonService::class)->updateInfo(\$request);
|
|
if (\$ret) {
|
|
return response()->json(\$ret);
|
|
}
|
|
else {
|
|
return back();
|
|
}
|
|
}
|
|
";
|
|
$code .= $snippet;
|
|
$content = preg_replace('/public function updateInfo\(Request \$request\)[.\s\S]+?{/', $code, $content);
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public static function addUsernameFieldToCandidateProfileForm() {
|
|
if (isModuleActive('JobPortalCandidate')) {
|
|
$path = module_path('JobPortalCandidate', 'Resources/views/admin/candidate/form.blade.php');
|
|
if (file_exists($path)) {
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/@include\('staffportal::components\._username_field3'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match('/<option value="professional"[.\s\S]+?<\/div>[.\s\S]+?<\/div>/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components._username_field3')
|
|
@endif
|
|
";
|
|
$code .= $snippet;
|
|
$content = preg_replace('/<option value="professional"[.\s\S]+?<\/div>[.\s\S]+?<\/div>/', $code, $content);
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public static function updateUsernameSupportInCandidateProfileController() {
|
|
if (isModuleActive('JobPortalCandidate')) {
|
|
$path = module_path('JobPortalCandidate', 'Http/Controllers/ProfileController.php');
|
|
if (file_exists($path)) {
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/isModuleActive\('StaffPortal'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match('/\$request->validate\(\[/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
if (isModuleActive('StaffPortal')) {
|
|
app(\Modules\StaffPortal\Services\CommonService::class)->validateCandidateStoreRequest(\$request);
|
|
}
|
|
";
|
|
$code = $snippet.$code;
|
|
$content = preg_replace('/\$request->validate\(\[/', $code, $content);
|
|
file_put_contents($path, $content);
|
|
}
|
|
|
|
$matches = null;
|
|
preg_match('/\$user->bio = \$request->bio;/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
if (isModuleActive('StaffPortal')) {
|
|
\$user->username = \$request->username;
|
|
}
|
|
";
|
|
$code .= $snippet;
|
|
$content = preg_replace('/\$user->bio = \$request->bio;/', $code, $content);
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public function addFrontendProfileMenu() {
|
|
$path = resource_path('views/frontend/amazy/partials/_mainmenu.blade.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/\@include\('staffportal::components\._frontend_profile_menu'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match('/<div class="mobile_menu d-block d-lg-none"><\/div>/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components._frontend_profile_menu')
|
|
@endif
|
|
";
|
|
$code = $snippet.$code;
|
|
$content = preg_replace('/<div class="mobile_menu d-block d-lg-none"><\/div>/', $code, $content);
|
|
//file_put_contents($path, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
|
|
public static function copyLangFile() {
|
|
$langFile = module_path('StaffPortal', 'Resources/lang/default/register.php');
|
|
if (file_exists($langFile)) {
|
|
File::copy($langFile, resource_path('lang/default/register.php'));
|
|
}
|
|
}
|
|
|
|
public function addUsernameFieldToStaffRegister() {
|
|
$path = app_path('Http/Controllers/Auth/RegisterController.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
|
|
if (!preg_match("/function staffRegister[.\s\S]+?username[.\s\S]+?\]\,/", $content)) {
|
|
$matches = null;
|
|
preg_match('/[.\s\S]+function staffRegister\([.\s\S]+?geographically[.\s\S]+?\]\,/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "\n\t\t\t'username' => ['required', 'string', 'unique:users,username', 'max:255'],";
|
|
$code .= $snippet;
|
|
$content = preg_replace("/[.\s\S]+function staffRegister\([.\s\S]+?geographically[.\s\S]+?\]\,/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/function create[.\s\S]+?username[.\s\S]+?isset\(\$phone\)[.\s\S]+?\,/", $content)) {
|
|
$matches = null;
|
|
preg_match('/[.\s\S]+function create\([.\s\S]+?username[.\s\S]+?\,/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = str_replace("'username' => isset(\$phone) ? \$phone : NULL", "'username' => isset(\$data['username']) ? \$data['username'] : NULL",$matches[0]);
|
|
$content = preg_replace("/[.\s\S]+function create\([.\s\S]+?username[.\s\S]+?\,/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
|
|
public function updateUserModel() {
|
|
$path = app_path('Models/User.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
|
|
if (!preg_match("/function staffRegister[.\s\S]+?username[.\s\S]+?\]\,/", $content)) {
|
|
$matches = null;
|
|
preg_match('/[.\s\S]+function staffRegister\([.\s\S]+?geographically[.\s\S]+?\]\,/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "\n\t\t\t'username' => ['required', 'string', 'unique:users,username', 'max:255'],";
|
|
$code .= $snippet;
|
|
$content = preg_replace("/[.\s\S]+function staffRegister\([.\s\S]+?geographically[.\s\S]+?\]\,/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/function create[.\s\S]+?username[.\s\S]+?isset\(\$phone\)[.\s\S]+?\,/", $content)) {
|
|
$matches = null;
|
|
preg_match('/[.\s\S]+function create\([.\s\S]+?username[.\s\S]+?\,/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = str_replace("'username' => isset(\$phone) ? \$phone : NULL", "'username' => isset(\$data['username']) ? \$data['username'] : NULL",$matches[0]);
|
|
$content = preg_replace("/[.\s\S]+function create\([.\s\S]+?username[.\s\S]+?\,/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/function setJobCategoryDataAttribute/", $content)) {
|
|
$matches = null;
|
|
preg_match('/[.\s\S]+function getNameAttribute\([.\s\S]+?last_name[.\s\S]+?}/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "\n
|
|
public function setJobCategoryDataAttribute(\$value)
|
|
{
|
|
\$this->attributes['job_category_data'] = json_encode(\$value);
|
|
}
|
|
";
|
|
$code = $code.$snippet;
|
|
$content = preg_replace("/[.\s\S]+function getNameAttribute\([.\s\S]+?last_name[.\s\S]+?}/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
|
|
public function addJobPortalMenu() {
|
|
$path = resource_path('views/frontend/amazy/pages/profile/partials/_menu.blade.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/include\(\'staffportal\:\:components._job_menu\'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match('/[.\s\S]+?common\.dashboard[.\s\S]+?<\/li>/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "\n\n\t\t\t@if (isModuleActive('StaffPortal'))\n\t\t\t\t@include('staffportal::components._job_menu')\n\t\t\t@endif";
|
|
$code .= $snippet;
|
|
$content = preg_replace("/[.\s\S]+?common\.dashboard[.\s\S]+?<\/li>/", $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
|
|
public static function addEmailSettingsToGeneralSettings() {
|
|
if (isModuleActive('GeneralSetting')) {
|
|
$path = module_path('GeneralSetting', 'Http/Controllers/GeneralSettingController.php');
|
|
|
|
$path = module_path('GeneralSetting', 'Resources/views/page_components/general_settings.blade.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/@include\('staffportal::components\._live_stream_email'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match('/[.\s\S]+pwa_app_name[.\s\S]+?<\/div>[.\s\S]+?<\/div>/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components._live_stream_email')
|
|
@endif
|
|
";
|
|
$code .= $snippet;
|
|
$content = preg_replace('/[.\s\S]+pwa_app_name[.\s\S]+?<\/div>[.\s\S]+?<\/div>/', $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/@include\('staffportal::components\._client_relations_email'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match('/[.\s\S]+pwa_app_name[.\s\S]+?<\/div>[.\s\S]+?<\/div>/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components._client_relations_email')
|
|
@endif
|
|
";
|
|
$code .= $snippet;
|
|
$content = preg_replace('/[.\s\S]+pwa_app_name[.\s\S]+?<\/div>[.\s\S]+?<\/div>/', $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
}
|
|
|
|
public static function updateCustomerDetails() {
|
|
if (isModuleActive('Customer')) {
|
|
$path = module_path('Customer', 'Resources/views/customers/show_details.blade.php');
|
|
if (file_exists($path)) {
|
|
$update = false;
|
|
$content = file_get_contents($path);
|
|
if (!preg_match("/isModuleActive\('StaffPortal'\)[.\s\S]+?\@include\(\'staffportal\:\:components\._signup_tab\'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match('/class=\"nav-link\" href=\"\#Address\" role=\"tab\" data-toggle=\"tab\"\>[.\s\S]+?\<\/li\>/', $content, $matches);
|
|
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components._signup_tab')
|
|
@endif
|
|
";
|
|
$code .= $snippet;
|
|
$content = preg_replace('/class=\"nav-link\" href=\"\#Address\" role=\"tab\" data-toggle=\"tab\"\>[.\s\S]+?\<\/li\>/', $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
|
|
if (!preg_match("/isModuleActive\('StaffPortal'\)[.\s\S]+?\@include\(\'staffportal\:\:components\._signup_tab_data\'\)/", $content)) {
|
|
$matches = null;
|
|
preg_match('/\<div role=\"tabpanel\" class=\"tab-pane fade\" id=\"Address\"\>[.\s\S]+?\<\/table\>[.\s\S]+?\<\/div\>[.\s\S]+?\<\/div\>[.\s\S]+?\<\/div\>[.\s\S]+?\<\/div\>[.\s\S]+?\<\/div\>[.\s\S]+?\<\/div\>/', $content, $matches);
|
|
if (count($matches) > 0) {
|
|
$code = $matches[0];
|
|
$snippet = "
|
|
@if (isModuleActive('StaffPortal'))
|
|
@include('staffportal::components._signup_tab_data')
|
|
@endif
|
|
";
|
|
$code .= $snippet;
|
|
$content = preg_replace('/\<div role=\"tabpanel\" class=\"tab-pane fade\" id=\"Address\"\>[.\s\S]+?\<\/table\>[.\s\S]+?\<\/div\>[.\s\S]+?\<\/div\>[.\s\S]+?\<\/div\>[.\s\S]+?\<\/div\>[.\s\S]+?\<\/div\>[.\s\S]+?\<\/div\>/', $code, $content);
|
|
$update = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($update) {
|
|
file_put_contents($path, $content);
|
|
}
|
|
}
|
|
} |