public function createCustomRecord($parameters) { $parameters['services'] = Service::where('lang_id_153', $parameters['lang']->id_001)->get(); $parameters['environments'] = Environment::where('lang_id_150', $parameters['lang']->id_001)->get(); $parameters['decorations'] = Decoration::where('lang_id_151', $parameters['lang']->id_001)->get(); $parameters['relationships'] = Relationship::where('lang_id_152', $parameters['lang']->id_001)->get(); $parameters['publications'] = Publication::all(); $parameters['restaurantTypes'] = array_map(function ($object) { $object->name = trans($object->name); return $object; }, config('hotels.restaurantTypes')); $parameters['attachmentFamilies'] = AttachmentFamily::getAttachmentFamilies(['resource_id_015' => 'hotels-hotel']); $parameters['customFieldGroups'] = CustomFieldGroup::where('resource_id_025', 'hotels-hotel')->get(); $parameters['attachmentsInput'] = json_encode([]); $parameters['hotelProductsIds'] = json_encode([]); $parameters['products'] = Product::builder()->where('active_111', true)->where('lang_id_112', $parameters['lang']->id_001)->get(); // get attachments products with photo list $parameters['attachmentsProducts'] = Attachment::builder()->where('lang_id_016', $parameters['lang']->id_001)->where('resource_id_016', 'market-product')->where('family_id_016', config('hotels.idAttachmentsFamily.productList'))->get()->keyBy('object_id_016'); if (isset($parameters['id'])) { // get attachments from base lang $attachments = AttachmentLibrary::getRecords($this->package, 'hotels-hotel', $parameters['id'], base_lang()->id_001, true); // merge parameters and attachments array $parameters = array_merge($parameters, $attachments); // get hotel products $parameters['hotelProducts'] = HotelProduct::getRecords(['hotel_id_177' => $parameters['id'], 'lang_id_177' => base_lang()->id_001])->keyBy('product_id_177'); $parameters['hotelProductsIds'] = json_encode($parameters['hotelProducts']->keys()->map(function ($item, $key) { return strval($item); })); } return $parameters; }
public function customIndex($parameters) { $parameters['urlParameters']['lang'] = base_lang()->id_001; $parameters['field'] = CustomField::getTranslationRecord(['id' => $parameters['field'], 'lang' => $parameters['lang']]); $parameters['customTransHeader'] = trans_choice($this->objectTrans, 2) . ' (' . trans_choice('pulsar::pulsar.field', 1) . ': ' . $parameters['field']->name_026 . ')'; return $parameters; }
public function jsonTerritorialAreas1FromCountry($country) { if ($country == "null") { return response()->json(['status' => 'error', 'message' => 'We expect a correct country code'], 400); } else { return response()->json(['status' => 'success', 'data' => Country::where('id_002', $country)->where('lang_id_002', base_lang()->id_001)->first()->getTerritorialAreas1]); } }
public function editCustomRecord($parameters) { $parameters['territorialAreas1'] = TerritorialArea1::getTerritorialAreas1FromCountry($parameters['country']); $parameters['country'] = Country::where('id_002', $parameters['country'])->where('lang_id_002', base_lang()->id_001)->first(); $parameters['customTrans'] = $parameters['country']->territorial_area_2_002; $parameters['customTransHeader'] = $parameters['country']->territorial_area_2_002 . ' (' . $parameters['country']->name_002 . ')'; return $parameters; }
public static function customCount($request, $parameters) { $query = TerritorialArea2::builder(); if (isset($parameters['country'])) { $query->where('country_id_004', $parameters['country']); } if (isset($parameters['lang'])) { $query->where('lang_id_002', $parameters['lang']); } else { $query->where('lang_id_002', base_lang()->id_001); } return $query; }
public function scopeBuilder($query, $lang = null) { return $query->leftJoin('012_111_product', '012_117_order_row.product_id_117', '=', '012_111_product.id_111')->leftJoin('012_112_product_lang', function ($join) use($lang) { $join->on('012_111_product.id_111', '=', '012_112_product_lang.id_112'); if ($lang !== null) { $join->where('012_112_product_lang.lang_id_112', '=', $lang); } else { // always need filter by lang, because order form, // need filter your order rows by lang without pass lang variable $join->where('012_112_product_lang.lang_id_112', '=', base_lang()->id_001); } }); }
public function createCustomRecord($parameters) { $parameters['attachmentFamilies'] = AttachmentFamily::getAttachmentFamilies(['resource_id_015' => 'spas-spa']); $parameters['customFieldGroups'] = CustomFieldGroup::where('resource_id_025', 'spas-spa')->get(); $parameters['attachmentsInput'] = json_encode([]); $parameters['hotels'] = Hotel::builder()->where('active_170', true)->get(); if (isset($parameters['id'])) { // get attachments from base lang $attachments = AttachmentLibrary::getRecords($this->package, 'spas-spa', $parameters['id'], base_lang()->id_001, true); // merge parameters and attachments array $parameters = array_merge($parameters, $attachments); } return $parameters; }
public function scopeBuilder($query) { // we not relate to countries, because there are two countries which relate, invoice and shipping, has not been found to create aliases on columns within a join return $query->join('009_301_customer', '012_116_order.customer_id_116', '=', '009_301_customer.id_301')->join('012_115_payment_method', function ($join) { $join->on('012_116_order.payment_method_id_116', '=', '012_115_payment_method.id_115')->where('012_115_payment_method.lang_id_115', '=', base_lang()->id_001); })->join('012_114_order_status', function ($join) { $join->on('012_116_order.status_id_116', '=', '012_114_order_status.id_114')->where('012_114_order_status.lang_id_114', '=', base_lang()->id_001); }); /* ->join('001_002_country', function ($join) { $join->on('012_116_order.invoice_country_id_116', '=', '001_002_country.id_002') ->on('001_002_country.lang_id_002', '=', '001_001_lang.id_001'); }) ->join('001_002_country', function ($join) { $join->on('012_116_order.shipping_country_id_116', '=', '001_002_country.id_002') ->on('001_002_country.lang_id_002', '=', '001_001_lang.id_001'); }); */ }
/** * Function to get attachment element with json string to new element * * @access public * @param string $routesConfigFile * @param string $resource * @param integer $objectId * @param string $lang * @param boolean $copyAttachment * @return array $response */ public static function getRecords($routesConfigFile, $resource, $objectId, $lang, $copyAttachment = false) { $response['attachments'] = Attachment::getRecords(['lang_id_016' => $lang, 'resource_id_016' => $resource, 'object_id_016' => $objectId, 'orderBy' => ['column' => 'sorting_016', 'order' => 'asc']]); $attachmentsInput = []; foreach ($response['attachments'] as &$attachment) { $tmpFileName = null; if ($copyAttachment) { // function to duplicate files if we create a new lang object // copy attachments base lang article to temp folder $tmpFileName = uniqid(); File::copy(public_path() . config($routesConfigFile . '.attachmentFolder') . '/' . $objectId . '/' . base_lang()->id_001 . '/' . $attachment->file_name_016, public_path() . config($routesConfigFile . '.tmpFolder') . '/' . $tmpFileName); // store tmp file name in attachment to know temporal name $attachment['tmp_file_name_016'] = $tmpFileName; } // get json data from attachment $attachmentData = json_decode($attachment->data_016); $attachmentsInput[] = ['id' => $attachment->id_016, 'family' => $attachment->family_id_016, 'type' => ['id' => $attachment->type_id_016, 'name' => $attachment->type_text_016, 'icon' => $attachmentData->icon], 'mime' => $attachment->mime_016, 'name' => $attachment->name_016, 'folder' => $copyAttachment ? config($routesConfigFile . '.tmpFolder') : config($routesConfigFile . '.attachmentFolder') . '/' . $attachment->object_id_016 . '/' . $attachment->lang_id_016, 'tmpFileName' => $tmpFileName, 'fileName' => $attachment->file_name_016, 'width' => $attachment->width_016, 'height' => $attachment->height_016, 'library' => $attachment->library_id_016, 'libraryFileName' => $attachment->library_file_name_016, 'sorting' => $attachment->sorting_016]; } $response['attachmentsInput'] = json_encode($attachmentsInput); return $response; }
public function createCustomRecord($parameters) { $parameters['sections'] = Section::all(); $parameters['families'] = ArticleFamily::all(); $parameters['tags'] = []; $tags = Tag::builder()->where('lang_id_358', $parameters['lang']->id_001)->get(); foreach ($tags as $tag) { $parameters['tags'][] = ['value' => $tag->id_358, 'label' => $tag->name_358]; } $parameters['categories'] = Category::builder()->where('lang_id_352', $parameters['lang']->id_001)->get(); $parameters['statuses'] = [(object) ['id' => 0, 'name' => trans('cms::pulsar.draft')], (object) ['id' => 1, 'name' => trans('cms::pulsar.publish')]]; $parameters['attachmentFamilies'] = AttachmentFamily::getAttachmentFamilies(['resource_id_015' => 'cms-article']); $parameters['attachmentsInput'] = json_encode([]); if (isset($parameters['id'])) { // get attachments from base lang $attachments = AttachmentLibrary::getRecords($this->package, 'cms-article', $parameters['id'], base_lang()->id_001, true); // merge parameters and attachments array $parameters = array_merge($parameters, $attachments); } return $parameters; }
public function scopeBuilder($query) { return $query->join('012_111_product', '011_222_product_prefix.product_id_222', '=', '012_111_product.id_111')->join('012_112_product_lang', '012_111_product.id_111', '=', '012_112_product_lang.id_112')->join('001_001_lang', '012_112_product_lang.lang_id_112', '=', '001_001_lang.id_001')->where('012_112_product_lang.lang_id_112', base_lang()->id_001); }
public function scopeBuilder($query) { return $query->join('001_002_country', function ($join) { $join->on('012_103_tax_rate_zone.country_id_103', '=', '001_002_country.id_002')->where('001_002_country.lang_id_002', '=', base_lang()->id_001); }); }
public function updateCustomRecord($parameters) { $order = Order::find($parameters['id']); Order::where('id_116', $parameters['id'])->update(['status_id_116' => $this->request->input('status'), 'payment_method_id_116' => $this->request->input('paymentMethod'), 'comments_116' => $this->request->has('comments') ? $this->request->input('comments') : null, 'has_gift_116' => $this->request->has('gift'), 'gift_from_116' => $this->request->has('giftFrom') ? $this->request->input('giftFrom') : null, 'gift_to_116' => $this->request->has('giftTo') ? $this->request->input('giftTo') : null, 'gift_message_116' => $this->request->has('giftMessage') ? $this->request->input('giftMessage') : null, 'customer_id_116' => $this->request->input('customerId'), 'customer_company_116' => $this->request->has('customerCompany') ? $this->request->input('customerCompany') : null, 'customer_tin_116' => $this->request->has('customerTin') ? $this->request->input('customerTin') : null, 'customer_name_116' => $this->request->has('customerName') ? $this->request->input('customerName') : null, 'customer_surname_116' => $this->request->has('customerSurname') ? $this->request->input('customerSurname') : null, 'customer_email_116' => $this->request->input('customerEmail'), 'customer_phone_116' => $this->request->has('customerPhone') ? $this->request->input('customerPhone') : null, 'customer_mobile_116' => $this->request->has('customerMobile') ? $this->request->input('customerMobile') : null, 'has_shipping_116' => $this->request->has('hasShipping'), 'shipping_company_116' => $this->request->has('shippingCompany') ? $this->request->input('shippingCompany') : null, 'shipping_name_116' => $this->request->has('shippingName') ? $this->request->input('shippingName') : null, 'shipping_surname_116' => $this->request->has('shippingSurname') ? $this->request->input('shippingSurname') : null, 'shipping_email_116' => $this->request->has('shippingEmail') ? $this->request->input('shippingEmail') : null, 'shipping_phone_116' => $this->request->has('shippingPhone') ? $this->request->input('shippingPhone') : null, 'shipping_mobile_116' => $this->request->has('shippingMobile') ? $this->request->input('shippingMobile') : null, 'shipping_amount_116' => $this->request->has('shippingAmount') ? $this->request->input('shippingAmount') : 0]); // if order status is different that previous status order, we record this change if ($order->status_id_116 != (int) $this->request->input('status')) { $orderStatus = OrderStatus::builder()->where('lang_id_114', base_lang()->id_001)->where('active_114', true)->get(); Order::setOrderLog($parameters['id'], trans('market::pulsar.message_user_change_order_status', ['user' => auth('pulsar')->user()->user_010, 'oldStatus' => $orderStatus->where('id_114', $order->status_id_116)->first()->name_114, 'newStatus' => $orderStatus->where('id_114', (int) $this->request->input('status'))->first()->name_114])); } }
public function scopeBuilder($query) { return $query->join('008_075_customer', '008_078_request.customer_id_078', '=', '008_075_customer.id_075')->join('001_010_user', '008_078_request.supervisor_id_078', '=', '001_010_user.id_010')->join('008_074_company', '008_078_request.company_id_078', '=', '008_074_company.id_074')->join('008_076_shop', '008_078_request.shop_id_078', '=', '008_076_shop.id_076')->join('008_077_address', '008_078_request.address_id_078', '=', '008_077_address.id_077')->join('008_071_brand', '008_078_request.brand_id_078', '=', '008_071_brand.id_071')->join('008_072_product', '008_078_request.product_id_078', '=', '008_072_product.id_072')->join('008_070_family', '008_078_request.family_id_078', '=', '008_070_family.id_070')->join('001_002_country', function ($join) { $join->on('008_078_request.country_id_078', '=', '001_002_country.id_002')->where('001_002_country.lang_id_002', '=', base_lang()->id_001); })->leftJoin('001_003_territorial_area_1', '008_078_request.territorial_area_1_id_078', '=', '001_003_territorial_area_1.id_003')->leftJoin('001_004_territorial_area_2', '008_078_request.territorial_area_2_id_078', '=', '001_004_territorial_area_2.id_004'); }
public function getDataObjects(Request $request) { $parameters = $request->route()->parameters(); $result = collect(config('booking.models'))->where('id', (int) $parameters['model']); if (count($result) === 0) { return response()->json(['status' => 'error', 'code' => 404, 'message' => 'Records not found']); } // model constructor $model = App::make($result->first()->model); $name = trans_choice($result->first()->name, 1); $primaryKey = $model->getKeyName(); $suffix = $model->getSuffix(); // use sofa to get lang from lang table of object query $objects = $model->builder()->where('lang_id', base_lang()->id_001)->get(); return response()->json(['status' => 'success', 'name' => $name, 'primaryKey' => $primaryKey, 'suffix' => $suffix, 'objects' => $objects]); }
/** * @access public * @return \Illuminate\Support\Facades\View */ public function createRecord() { // get parameters from url route $parameters = $this->request->route()->parameters(); $parameters['urlParameters'] = $parameters; // check if create route has modal // is necessary to have modal paramenter in all routes for proper operation if (Route::current()->hasParameter('modal')) { // check if this element is modal, to mark in your url petition if (isset($parameters['modal']) && $parameters['modal'] == 1) { $parameters['urlParameters']['modal'] = 1; } else { $parameters['urlParameters']['modal'] = 0; } } // get lang object if (isset($parameters['lang'])) { $parameters['lang'] = Lang::builder()->find($parameters['lang']); } $parameters = $this->createCustomRecord($parameters); // check if parameters is a RedirectResponse object, to send request to other url if (is_object($parameters) && get_class($parameters) == \Illuminate\Http\RedirectResponse::class) { return $parameters; } $parameters['resource'] = $this->resource; $parameters['package'] = $this->package; $parameters['folder'] = $this->folder; $parameters['routeSuffix'] = $this->routeSuffix; $parameters['icon'] = $this->icon; // traslate of object that we are operate, this variable is instance in controller $parameters['objectTrans'] = isset($this->objectTrans) && $this->objectTrans != null ? Miscellaneous::getObjectTransValue($parameters, $this->objectTrans) : null; // check if action is store or storeLang if (isset($parameters['id']) && isset($parameters['lang'])) { // set baseLang to get baseLang object $parametersAux = $parameters; $parametersAux['lang'] = base_lang()->id_001; $parameters['object'] = call_user_func($this->model . '::getTranslationRecord', $parametersAux); $parameters['action'] = 'storeLang'; } else { $parameters['action'] = 'store'; } // set viewParamentes on parameters for throw to view $parameters['viewParameters'] = $this->viewParameters; // check if exist create view, default all request go to common view if (view()->exists($this->package . '::' . $this->folder . '.create', $parameters)) { return view($this->package . '::' . $this->folder . '.create', $parameters); } else { return view($this->package . '::' . $this->folder . '.form', $parameters); } }
public function customIndex($parameters) { $parameters['urlParameters']['lang'] = base_lang()->id_001; return $parameters; }
public function editCustomRecord($parameters) { $parameters['products'] = Product::builder()->where('lang_id_112', base_lang()->id_001)->get(); return $parameters; }
public function editCustomRecord($parameters) { $parameters['categories'] = Category::where('lang_id_110', $parameters['lang']->id_001)->get(); $parameters['productTypes'] = array_map(function ($object) { $object->name = trans($object->name); return $object; }, config('market.productTypes')); $parameters['priceTypes'] = array_map(function ($object) { $object->name = trans($object->name); return $object; }, config('market.priceTypes')); $parameters['productClassTaxes'] = ProductClassTax::builder()->get(); $parameters['parentsProducts'] = Product::builder()->where('lang_id_112', base_lang()->id_001)->where('id_111', '<>', $parameters['id'])->whereNull('parent_product_id_111')->get(); $taxRules = TaxRule::builder()->where('country_id_103', config('market.taxCountry'))->where('customer_class_tax_id_106', config('market.taxCustomerClass'))->where('product_class_tax_id_107', $parameters['object']->product_class_tax_id_111)->orderBy('priority_104', 'asc')->get(); $taxes = TaxRuleLibrary::taxCalculateOverSubtotal($parameters['object']->subtotal_111, $taxRules); // ATTENTION! we create custom properties tax_amount_111 and total_111 $parameters['object']->tax_amount_111 = $taxes->sum('taxAmount'); $parameters['object']->total_111 = $parameters['object']->subtotal_111 + $parameters['object']->tax_amount_111; $attachments = AttachmentLibrary::getRecords($this->package, 'market-product', $parameters['object']->id_111, $parameters['lang']->id_001); $parameters['customFieldGroups'] = CustomFieldGroup::builder()->where('resource_id_025', 'market-product')->get(); $parameters['attachmentFamilies'] = AttachmentFamily::getAttachmentFamilies(['resource_id_015' => 'market-product']); $parameters = array_merge($parameters, $attachments); return $parameters; }
public function apiGetDataRow() { $parameters = $this->request->route()->parameters(); $orderRow = OrderRow::builder(base_lang())->where('id_117', $parameters['id'])->first(); // get object from json, and convert to array $data = json_decode($orderRow->data_117, true); return view('market::order.info_modal', $data); }
private function sendEmails(Booking $booking) { // objects from place if (isset($booking->place_id_225)) { $result = collect(config('booking.models'))->where('id', $booking->place_id_225); if (count($result) === 0) { return response()->json(['status' => 'error', 'code' => 404, 'message' => 'Records not found']); } // model constructor $model = App::make($result->first()->model); // use sofa to get lang from lang table of object query $establishment = $model->builder()->where('lang_id', base_lang()->id_001)->where('id', $booking->object_id_225)->first(); $attachment = Attachment::builder()->where('lang_id_016', base_lang()->id_001)->where('resource_id_016', 'hotels-hotel')->where('object_id_016', $establishment->id)->where('family_id_016', 1)->orderBy('sorting', 'asc')->first(); //**************************** // get values to Master Card //**************************** $customFields = CustomField::where('group_id_026', 4)->get(); if (isset($customFields) && $customFields->where('name_026', 'master_card_feature')->count() > 0) { $masterCardFeatures = $customFields->where('name_026', 'master_card_feature')->first()->getResults()->where('object_id_028', $establishment->id_170)->where('lang_id_028', 'es')->get()->first(); } else { $masterCardFeatures = null; } // get vouchers $vouchers = Voucher::builder()->whereIn('id_226', json_decode($booking->data_225))->get(); // status confirmed if ($booking->status_225 == 1) { Mail::to('*****@*****.**')->bcc('*****@*****.**')->cc('*****@*****.**')->send(new BookingEmail('booking::emails.customer_booking_notification', trans('booking::pulsar.subject_customer_booking_email', ['bookingId' => $booking->id_225 . '/' . date('Y')]), $booking, $establishment, $vouchers, $attachment, $masterCardFeatures)); Mail::to('*****@*****.**')->bcc('*****@*****.**')->cc('*****@*****.**')->send(new BookingEmail('booking::emails.hotel_booking_notification', trans('booking::pulsar.subject_hotel_booking_email', ['bookingId' => $booking->id_225 . '/' . date('Y')]), $booking, $establishment, $vouchers, $attachment, $masterCardFeatures)); } elseif ($booking->status_225 == 3) { Mail::to('*****@*****.**')->bcc('*****@*****.**')->cc('*****@*****.**')->send(new BookingEmail('booking::emails.customer_cancel_booking_notification', trans('booking::pulsar.subject_customer_cancel_booking_email', ['bookingId' => $booking->id_225 . '/' . date('Y')]), $booking, $establishment, $vouchers, $attachment, $masterCardFeatures)); Mail::to('*****@*****.**')->bcc('*****@*****.**')->cc('*****@*****.**')->send(new BookingEmail('booking::emails.hotel_cancel_booking_notification', trans('booking::pulsar.subject_hotel_cancel_booking_email', ['bookingId' => $booking->id_225 . '/' . date('Y')]), $booking, $establishment, $vouchers, $attachment, $masterCardFeatures)); } } }
/** * Get attachments from customer * * @return mixed */ public function getAttachments() { return $this->hasMany('Syscover\\Pulsar\\Models\\Attachment', 'object_id_016')->where('001_016_attachment.lang_id_016', base_lang()->id_001)->where('001_016_attachment.resource_id_016', 'crm-customer')->leftJoin('001_015_attachment_family', '001_016_attachment.family_id_016', '=', '001_015_attachment_family.id_015')->orderBy('001_016_attachment.sorting_016'); }
public function editCustomRecord($parameters) { $parameters = $this->commonCustomRecord($parameters); // objects from place if (isset($parameters['object']->place_id_225)) { $result = collect(config('booking.models'))->where('id', $parameters['object']->place_id_225); if (count($result) === 0) { return response()->json(['status' => 'error', 'code' => 404, 'message' => 'Records not found']); } // model constructor $model = App::make($result->first()->model); // use sofa to get lang from lang table of object query $parameters['objects'] = $model->builder()->where('lang_id', base_lang()->id_001)->get(); $parameters['objectName'] = trans_choice($result->first()->name, 1); $parameters['objectKey'] = $model->getKeyName(); } $parameters['vouchers'] = Voucher::builder()->where('booking_id_226', $parameters['object']->id_225)->get(); $parameters['afterButtonFooter'] = '<a class="btn btn-info margin-l10" href="#">' . trans('booking::pulsar.save_resend') . '</a>'; return $parameters; }
/** * Function to get html from custom fields * * @param $parameters * @return \Illuminate\Http\JsonResponse * @throws \Exception * @throws \Throwable */ public static function getCustomFields($parameters) { // get custom fields $customFields = CustomField::getRecords(['lang_026' => $parameters['lang'], 'group_id_026' => $parameters['customFieldGroup']]); if ($parameters['object']) { if (!empty($parameters['action']) && $parameters['action'] == 'storeLang') { // if is a new object translated $langFieldResults = base_lang()->id_001; } else { $langFieldResults = $parameters['lang']; } // get results if there is a object $customFieldResults = CustomFieldResult::where('lang_id_028', $langFieldResults)->where('object_id_028', $parameters['object'])->where('resource_id_028', $parameters['resource'])->get(); } $html = ''; foreach ($customFields as $customField) { $setValue = isset($customFieldResults) && $customFieldResults->where('field_id_028', $customField->id_026)->count() > 0; // add suffix '_custom' to avoid conflict with other field names if (collect(config('pulsar.fieldTypes'))->keyBy('id')[$customField->field_type_id_026]->key == 'selectMultiple' || collect(config('pulsar.fieldTypes'))->keyBy('id')[$customField->field_type_id_026]->key == 'selectMultiple2') { // TODO: se pueden coger todos los valores antes del foreach para evitar multiples consultas $customFieldValues = $customField->getValues()->where('lang_id_027', base_lang()->id_001)->get(); $multipleSelectValue = null; if ($setValue) { if (collect(config('pulsar.dataTypes'))->keyBy('id')[$customField->data_type_id_026]->type == 'array') { $multipleSelectValue = $customFieldResults->where('field_id_028', $customField->id_026)->first()->value_028; } else { $multipleSelectValue = $customFieldResults->where('field_id_028', $customField->id_026)->pluck('value_028')->toArray(); } } // check if is select2 plugin $isSelect2 = collect(config('pulsar.fieldTypes'))->keyBy('id')[$customField->field_type_id_026]->key == 'selectMultiple2'; $html .= view(collect(config('pulsar.fieldTypes'))->keyBy('id')[$customField->field_type_id_026]->view, ['label' => $customField['label_026'], 'name' => $customField['name_026'] . '_custom[]', 'fieldSize' => empty($customField['field_size_026']) ? 10 : $customField['field_size_026'], 'objects' => $customFieldValues, 'idSelect' => 'id_027', 'nameSelect' => 'name_027', 'required' => $customField->required_026, 'class' => $isSelect2 ? 'select2' : null, 'id' => $customField['name_026'] . '_custom', 'multiple' => true, 'data' => $isSelect2 ? ['language' => config('app.locale'), 'width' => '100%', 'error-placement' => 'select2-' . $customField['name_026'] . '_custom' . '-outer-container'] : null, 'value' => $setValue ? $multipleSelectValue : null])->render(); } elseif (collect(config('pulsar.fieldTypes'))->keyBy('id')[$customField->field_type_id_026]->key == 'select' || collect(config('pulsar.fieldTypes'))->keyBy('id')[$customField->field_type_id_026]->key == 'select2') { $customFieldValues = $customField->getValues()->where('lang_id_027', base_lang()->id_001)->get(); // check if is select2 plugin $isSelect2 = collect(config('pulsar.fieldTypes'))->keyBy('id')[$customField->field_type_id_026]->key == 'select2'; $html .= view(collect(config('pulsar.fieldTypes'))->keyBy('id')[$customField->field_type_id_026]->view, ['label' => $customField['label_026'], 'name' => $customField['name_026'] . '_custom', 'fieldSize' => empty($customField['field_size_026']) ? 10 : $customField['field_size_026'], 'objects' => $customFieldValues, 'idSelect' => 'id_027', 'nameSelect' => 'name_027', 'required' => $customField->required_026, 'class' => $isSelect2 ? 'select2' : null, 'id' => $customField['name_026'] . '_custom', 'data' => $isSelect2 ? ['language' => config('app.locale'), 'width' => '100%', 'error-placement' => 'select2-' . $customField['name_026'] . '_custom' . '-outer-container'] : null, 'value' => $setValue ? $customFieldResults->where('field_id_028', $customField->id_026)->first()->value_028 : null])->render(); } elseif (collect(config('pulsar.fieldTypes'))->keyBy('id')[$customField->field_type_id_026]->key == 'checkbox') { $html .= view(collect(config('pulsar.fieldTypes'))->keyBy('id')[$customField->field_type_id_026]->view, ['label' => $customField['label_026'], 'name' => $customField['name_026'] . '_custom', 'fieldSize' => empty($customField['field_size_026']) ? 10 : $customField['field_size_026'], 'required' => $customField->required_026, 'checked' => $setValue ? $customFieldResults->where('field_id_028', $customField->id_026)->first()->value_028 : null])->render(); } else { $html .= view(collect(config('pulsar.fieldTypes'))->keyBy('id')[$customField->field_type_id_026]->view, ['label' => $customField['label_026'], 'name' => $customField['name_026'] . '_custom', 'fieldSize' => empty($customField['field_size_026']) ? 10 : $customField['field_size_026'], 'required' => $customField->required_026, 'value' => $setValue ? $customFieldResults->where('field_id_028', $customField->id_026)->first()->value_028 : null])->render(); } } return $html; }
public static function getTranslationRecord($parameters) { $customField = CustomField::join('001_025_field_group', '001_026_field.group_id_026', '=', '001_025_field_group.id_025')->where('id_026', $parameters['id'])->first(); $data = collect(json_decode($customField->data_026, true)['labels']); if (isset($data[$parameters['lang']])) { $customField->label_026 = $data[$parameters['lang']]; $customField->lang_026 = $parameters['lang']; } elseif (isset($data[base_lang()->id_001])) { $customField->label_026 = $data[base_lang()->id_001]; $customField->lang_026 = base_lang()->id_001; } else { $customField->label_026 = null; $customField->lang_026 = null; } return $customField; }
public static function customCountIndexRecords($query, $parameters) { return $query->select('id_111', DB::raw('GROUP_CONCAT(name_110 SEPARATOR \', \') AS name_110'))->leftJoin('012_113_products_categories', '012_111_product.id_111', '=', '012_113_products_categories.product_id_113')->leftJoin('012_110_category', function ($join) { $join->on('012_113_products_categories.category_id_113', '=', '012_110_category.id_110')->where('012_110_category.lang_id_110', '=', base_lang()->id_001); })->groupBy('id_111')->get()->count(); }
public function scopeBuilder($query) { return $query->join('001_002_country', function ($join) { $join->on('008_077_address.country_id_077', '=', '001_002_country.id_002')->where('001_002_country.lang_id_002', '=', base_lang()->id_001); })->leftJoin('001_003_territorial_area_1', '008_077_address.territorial_area_1_id_077', '=', '001_003_territorial_area_1.id_003')->leftJoin('001_004_territorial_area_2', '008_077_address.territorial_area_2_id_077', '=', '001_004_territorial_area_2.id_004'); }
public function editCustomRecord($parameters) { $parameters['langs'] = Lang::all(); $parameters['groups'] = Group::all(); $parameters['genres'] = array_map(function ($object) { $object->name = trans($object->name); return $object; }, config('pulsar.genres')); $parameters['treatments'] = array_map(function ($object) { $object->name = trans($object->name); return $object; }, config('pulsar.treatments')); $parameters['states'] = array_map(function ($object) { $object->name = trans($object->name); return $object; }, config('pulsar.states')); // get attachments elements $attachments = AttachmentLibrary::getRecords('crm', 'crm-customer', $parameters['object']->id_301, base_lang()->id_001); // merge parameters and attachments array $parameters['attachmentFamilies'] = AttachmentFamily::getAttachmentFamilies(['resource_id_015' => 'cms-article']); $parameters = array_merge($parameters, $attachments); return $parameters; }