Homparty dev
This commit is contained in:
parent
9252094a04
commit
ac0d5b781e
60 changed files with 3443 additions and 293 deletions
|
|
@ -34,6 +34,10 @@ class ContractPDFRepository extends BaseRepository {
|
|||
$this->{$name} = $value;
|
||||
}
|
||||
|
||||
private function convert($str){
|
||||
return iconv('UTF-8', 'windows-1252', $str);
|
||||
}
|
||||
|
||||
public function createContractPDF() {
|
||||
|
||||
$pdf = new ContractPDF();
|
||||
|
|
@ -47,56 +51,58 @@ class ContractPDFRepository extends BaseRepository {
|
|||
$y = 70;
|
||||
$nl = 17.5;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pdf->Write(0, $this->model->account->m_account);
|
||||
$pdf->Write(0, $this->convert($this->model->account->m_account));
|
||||
$pdf->SetXY($x2, $y);
|
||||
$pdf->Write(0, now()->format("d.m.Y"));
|
||||
|
||||
$y += $nl;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pdf->Write(0, $this->model->account->company);
|
||||
$pdf->Write(0, $this->convert($this->model->account->company));
|
||||
$pdf->SetXY($x2, $y);
|
||||
$pre = $this->model->account->pre_phone_id != "" ? $this->model->account->pre_phone->phone." " : "";
|
||||
$pdf->Write(0, $pre.$this->model->account->phone);
|
||||
$pre = $this->model->account->pre_phone_id != "" ? $this->convert($this->model->account->pre_phone->phone)." " : "";
|
||||
$pdf->Write(0, $pre.$this->convert($this->model->account->phone));
|
||||
|
||||
|
||||
|
||||
$y += $nl;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pdf->Write(0, $this->model->account->m_first_name);
|
||||
$pdf->Write(0, $this->convert($this->model->account->m_first_name));
|
||||
$pdf->SetXY($x2, $y);
|
||||
$pre = $this->model->account->pre_mobil_id != "" ? $this->model->account->pre_mobil->phone." " : "";
|
||||
$pdf->Write(0, $pre.$this->model->account->mobil);
|
||||
$pre = $this->model->account->pre_mobil_id != "" ? $this->convert($this->model->account->pre_mobil->phone)." " : "";
|
||||
$pdf->Write(0, $pre.$this->convert($this->model->account->mobil));
|
||||
|
||||
$y += $nl;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pdf->Write(0, $this->model->account->m_last_name);
|
||||
$pdf->Write(0, $this->convert($this->model->account->m_last_name));
|
||||
$pdf->SetXY($x2, $y);
|
||||
$pdf->Write(0, $this->model->email);
|
||||
$pdf->Write(0, $this->convert($this->model->email));
|
||||
|
||||
$y += $nl;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pdf->Write(0, $this->model->account->address);
|
||||
$pdf->Write(0, $this->convert($this->model->account->address));
|
||||
$pdf->SetXY($x2, $y);
|
||||
$pdf->Write(0, $this->model->account->birthday);
|
||||
$pdf->Write(0, $this->convert($this->model->account->birthday));
|
||||
|
||||
$y += $nl;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pdf->Write(0, $this->model->account->zipcode." ".$this->model->account->city);
|
||||
$pdf->Write(0, $this->convert($this->model->account->zipcode)." ".$this->convert($this->model->account->city));
|
||||
|
||||
$y += $nl;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pre = $this->model->account->country_id ? $this->model->account->country->de." " : "";
|
||||
$pre = $this->model->account->country_id ? $this->convert($this->model->account->country->de)." " : "";
|
||||
$pdf->Write(0, $pre);
|
||||
|
||||
if($this->model->m_sponsor){
|
||||
|
||||
$y += 48;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pdf->Write(0, $this->model->user_sponsor->account->company);
|
||||
$pdf->Write(0, $this->convert($this->model->user_sponsor->account->company));
|
||||
$pdf->SetXY($x2, $y);
|
||||
$pdf->Write(0, $this->model->user_sponsor->account->m_account);
|
||||
$pdf->Write(0, $this->convert($this->model->user_sponsor->account->m_account));
|
||||
|
||||
$y += $nl;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pdf->Write(0, $this->model->user_sponsor->account->m_first_name." ".$this->model->user_sponsor->account->m_last_name);
|
||||
$pdf->Write(0, $this->convert($this->model->user_sponsor->account->m_first_name)." ".$this->convert($this->model->user_sponsor->account->m_last_name));
|
||||
|
||||
$website = $this->model->user_sponsor->shop()->count() ? $this->model->user_sponsor->shop->getSubdomain(false) : "www.mivita.care";
|
||||
|
||||
|
|
@ -112,9 +118,9 @@ class ContractPDFRepository extends BaseRepository {
|
|||
|
||||
|
||||
$pdf->SetXY($x1, 65);
|
||||
$pdf->Write(0, $this->model->account->m_first_name." ".$this->model->account->m_last_name);
|
||||
$pdf->Write(0, $this->convert($this->model->account->m_first_name)." ".$this->convert($this->model->account->m_last_name));
|
||||
$pdf->SetXY($x2, 65);
|
||||
$pdf->Write(0, $this->model->account->m_account);
|
||||
$pdf->Write(0, $this->convert($this->model->account->m_account));
|
||||
|
||||
$pdf->AddPage('P', array(210, 297));
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use App\Models\Product;
|
|||
use App\Models\ProductAttribute;
|
||||
use App\Models\ProductCategory;
|
||||
use App\Models\ProductImage;
|
||||
use App\Models\ProductIngredient;
|
||||
|
||||
class ProductRepository extends BaseRepository {
|
||||
|
||||
|
|
@ -40,12 +41,32 @@ class ProductRepository extends BaseRepository {
|
|||
|
||||
$this->updateCategories(isset($data['categories']) ? $data['categories'] : array());
|
||||
$this->updateAttributes(isset($data['attributes']) ? $data['attributes'] : array());
|
||||
$this->updateIngredients(isset($data['product_ingredients']) ? $data['product_ingredients'] : array());
|
||||
$this->updateCountryPrices($data);
|
||||
|
||||
|
||||
return $this->model;
|
||||
}
|
||||
|
||||
|
||||
public function updateIngredients($data = array())
|
||||
{
|
||||
$ProductIngredient = $this->model->p_ingredients()->pluck('ingredient_id')->toArray();
|
||||
//set attr
|
||||
if(is_array($data)){
|
||||
foreach ($data as $id) {
|
||||
//not use
|
||||
if(!in_array($id, $ProductIngredient)){
|
||||
ProductIngredient::create([
|
||||
'product_id' => $this->model->id,
|
||||
'ingredient_id' => $id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function updateCategories($data = array())
|
||||
{
|
||||
foreach ($this->model->categories as $category) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue