Ejemplo n.º 1
0
 public function storeCustomRecord($parameters)
 {
     if ($this->request->hasFile('attachment')) {
         $filename = Miscellaneous::uploadFiles('attachment', public_path() . '/packages/syscover/octopus/storage/attachment/request');
     } elseif ($this->request->has('attachment')) {
         File::copy(public_path() . '/packages/syscover/octopus/storage/attachment/stock/' . $this->request->input('attachment'), public_path() . '/packages/syscover/octopus/storage/attachment/request/' . $this->request->input('attachment'));
         $filename = $this->request->input('attachment');
     }
     $octopusRequest = OctopusRequest::create(['supervisor_id_078' => $this->request->input('supervisor'), 'customer_id_078' => $this->request->input('customer'), 'shop_id_078' => $this->request->input('shopId'), 'company_id_078' => $this->request->input('company'), 'family_id_078' => $this->request->input('family'), 'brand_id_078' => $this->request->input('brand'), 'product_id_078' => $this->request->input('product'), 'address_id_078' => $this->request->has('aliasId') ? $this->request->input('aliasId') : null, 'company_name_078' => $this->request->has('companyName') ? $this->request->input('companyName') : null, 'name_078' => $this->request->has('name') ? $this->request->input('name') : null, 'surname_078' => $this->request->has('surname') ? $this->request->input('surname') : null, 'country_id_078' => $this->request->input('country'), 'territorial_area_1_id_078' => $this->request->has('territorialArea1') ? $this->request->input('territorialArea1') : null, 'territorial_area_2_id_078' => $this->request->has('territorialArea2') ? $this->request->input('territorialArea2') : null, 'territorial_area_3_id_078' => $this->request->has('territorialArea3') ? $this->request->input('territorialArea3') : null, 'cp_078' => $this->request->has('cp') ? $this->request->input('cp') : null, 'locality_078' => $this->request->has('locality') ? $this->request->input('locality') : null, 'address_078' => $this->request->has('address') ? $this->request->input('address') : null, 'phone_078' => $this->request->has('phone') ? $this->request->input('phone') : null, 'email_078' => $this->request->has('email') ? $this->request->input('email') : null, 'observations_078' => $this->request->has('observations') ? $this->request->input('observations') : null, 'date_078' => \DateTime::createFromFormat(config('pulsar.datePattern'), $this->request->input('date'))->getTimestamp(), 'date_text_078' => $this->request->input('date'), 'view_width_078' => $this->request->input('viewWidth'), 'view_height_078' => $this->request->input('viewHeight'), 'total_width_078' => $this->request->has('totalWidth') ? $this->request->input('totalWidth') : null, 'total_height_078' => $this->request->has('totalHeight') ? $this->request->input('totalHeight') : null, 'units_078' => $this->request->input('units'), 'expiration_078' => $this->request->has('expiration') ? \DateTime::createFromFormat(config('pulsar.datePattern'), $this->request->input('expiration'))->getTimestamp() : null, 'expiration_text_078' => $this->request->has('expiration') ? $this->request->input('expiration') : null, 'attachment_078' => isset($filename) ? $filename : null, 'comments_078' => $this->request->has('comments') ? $this->request->input('comments') : null]);
     // si la peticion proviene de un stock, damos por expirado el stock duplicado
     if ($this->request->has('stock')) {
         Stock::where('id_080', $this->request->input('stock'))->update(['expiration_080' => date('U'), 'expiration_text_080' => date(config('pulsar.datePattern'))]);
     }
     $this->sendRequestEmail($octopusRequest->id_078, 'store');
 }
Ejemplo n.º 2
0
 public function ajaxDeleteFile()
 {
     File::delete(public_path() . '/packages/syscover/octopus/storage/attachment/stock/' . $this->request->input('file'));
     Stock::where('id_080', $this->request->input('id'))->update(['attachment_080' => null]);
     return response()->json(['status' => 'success', 'file' => $this->request->input('file'), 'id' => $this->request->input('id')]);
 }