kekitek
kekitek
FFilament
Created by kekitek on 6/22/2024 in #❓┊help
Avoid Section to break and add horizontal scrollbar
Solved it by using a different layout. Thank you guys
22 replies
FFilament
Created by kekitek on 6/15/2024 in #❓┊help
How to import json/array from csv?
I am working on it for days now, but no clue how to get the array properly imported. I tried it like so
ExportColumn::make('operating_expenses'),
ExportColumn::make('operating_expenses'),
like so
ExportColumn::make('operating_expenses')
->listAsJson(),
ExportColumn::make('operating_expenses')
->listAsJson(),
tried to cast it in the
beforeValidate() function
beforeValidate() function
tried it also with
castStateUsing()
castStateUsing()
it always gets imported the same
"[{\"cost\":0,\"name\":\"Home inspection\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Appraisal\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Loan Points\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Lender Fees\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Title & Escrow Fees\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Transfer Taxes\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Attorney Fees\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Wholesaler Fees\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"}]"
"[{\"cost\":0,\"name\":\"Home inspection\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Appraisal\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Loan Points\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Lender Fees\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Title & Escrow Fees\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Transfer Taxes\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Attorney Fees\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Wholesaler Fees\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"}]"
Please if someone has experience with it and could help me.
4 replies
FFilament
Created by kekitek on 6/22/2024 in #❓┊help
Avoid Section to break and add horizontal scrollbar
I want to preserve exaclty this layout for small devices. So that they have to use the scrollbar to go to the right.
22 replies
FFilament
Created by kekitek on 6/22/2024 in #❓┊help
Avoid Section to break and add horizontal scrollbar
How to preserve the width of the columns so, that they are not overlapping
22 replies
FFilament
Created by kekitek on 6/22/2024 in #❓┊help
Avoid Section to break and add horizontal scrollbar
Somehow this does not work
22 replies
FFilament
Created by kekitek on 6/22/2024 in #❓┊help
Avoid Section to break and add horizontal scrollbar
No description
22 replies
FFilament
Created by kekitek on 6/22/2024 in #❓┊help
Avoid Section to break and add horizontal scrollbar
I got it to work now with
->columns(['default' => 8]),
->columns(['default' => 8]),
now the columns don't break anymore. But now the problem is the columns shrink, need to prevent this.
22 replies
FFilament
Created by kekitek on 6/22/2024 in #❓┊help
Avoid Section to break and add horizontal scrollbar
but I set the section columns to 8.
->columns(8),
->columns(8),
22 replies
FFilament
Created by kekitek on 6/22/2024 in #❓┊help
Avoid Section to break and add horizontal scrollbar
Section::make()
->extraAttributes(['class' => 'overflow-x-scroll'])
->schema([
RepeatableEntry::make('calculationProjectionsFirstYear')
->label('Income')
->schema([
TextEntry::make('gross_rent')
->hiddenLabel(true)
->state('Gross Rent'),

TextEntry::make('vacancy')
->hiddenLabel(true)
->state('Vacancy'),

TextEntry::make('operating_income_total')
->hiddenLabel(true)
->state('Operating Income'),
])
->contained(false)
->columnSpan(1),

RepeatableEntry::make('calculationProjectionsFirstYear')
->label('Year 1')
->schema([
TextEntry::make('gross_rent')
->hiddenLabel(true)
->money('AED', 100),

TextEntry::make('vacancy')
->hiddenLabel(true)
->prefix('- ')
->money('AED', 100),

TextEntry::make('operating_income_total')
->hiddenLabel(true)
->prefix('= ')
->color(function ($state) {
return $this->getFieldColor($state);
})
->money('AED', 100),
])
->contained(false)
->columnSpan(1),

More Repeatables
Section::make()
->extraAttributes(['class' => 'overflow-x-scroll'])
->schema([
RepeatableEntry::make('calculationProjectionsFirstYear')
->label('Income')
->schema([
TextEntry::make('gross_rent')
->hiddenLabel(true)
->state('Gross Rent'),

TextEntry::make('vacancy')
->hiddenLabel(true)
->state('Vacancy'),

TextEntry::make('operating_income_total')
->hiddenLabel(true)
->state('Operating Income'),
])
->contained(false)
->columnSpan(1),

RepeatableEntry::make('calculationProjectionsFirstYear')
->label('Year 1')
->schema([
TextEntry::make('gross_rent')
->hiddenLabel(true)
->money('AED', 100),

TextEntry::make('vacancy')
->hiddenLabel(true)
->prefix('- ')
->money('AED', 100),

TextEntry::make('operating_income_total')
->hiddenLabel(true)
->prefix('= ')
->color(function ($state) {
return $this->getFieldColor($state);
})
->money('AED', 100),
])
->contained(false)
->columnSpan(1),

More Repeatables
22 replies
FFilament
Created by kekitek on 6/22/2024 in #❓┊help
Avoid Section to break and add horizontal scrollbar
Everything breaks into the next line
22 replies
FFilament
Created by kekitek on 6/22/2024 in #❓┊help
Avoid Section to break and add horizontal scrollbar
No description
22 replies
FFilament
Created by kekitek on 6/22/2024 in #❓┊help
Avoid Section to break and add horizontal scrollbar
No description
22 replies
FFilament
Created by kekitek on 6/22/2024 in #❓┊help
Avoid Section to break and add horizontal scrollbar
Sure I want the whole section to be scrollable, but can't prevent the columns to break. So I want the section to be full width.
22 replies
FFilament
Created by kekitek on 6/15/2024 in #❓┊help
How to import json/array from csv?
Tried it like so now, but no succes always imports it as
"[{\"cost\":0,\"name\":\"Home inspection\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Appraisal\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Loan Points\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Lender Fees\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Title & Escrow Fees\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Transfer Taxes\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Attorney Fees\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Wholesaler Fees\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"}]"
"[{\"cost\":0,\"name\":\"Home inspection\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Appraisal\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Loan Points\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Lender Fees\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Title & Escrow Fees\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Transfer Taxes\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Attorney Fees\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"},{\"cost\":0,\"name\":\"Wholesaler Fees\",\"in_loan\":0,\"percent\":0,\"cost_type\":\"set-amount\"}]"
protected function beforeValidate(): void
{
$this->data['purchase_costs'] = $this->parseCosts($this->data['purchase_costs']);
$this->data['rehab_costs'] = $this->parseCosts($this->data['rehab_costs']);
$this->data['other_income'] = $this->parseCosts($this->data['other_income']);
}

/**
* Parse the costs.
*/
protected function parseCosts($costs)
{
if (empty($costs)) {
return null;
}

return $this->tryParseCosts($costs);
}

/**
* Try to parse the costs.
*/
protected function tryParseCosts($costs)
{
try {
return json_decode($costs, true);
} catch (\Exception $e) {
return null;
}
}
protected function beforeValidate(): void
{
$this->data['purchase_costs'] = $this->parseCosts($this->data['purchase_costs']);
$this->data['rehab_costs'] = $this->parseCosts($this->data['rehab_costs']);
$this->data['other_income'] = $this->parseCosts($this->data['other_income']);
}

/**
* Parse the costs.
*/
protected function parseCosts($costs)
{
if (empty($costs)) {
return null;
}

return $this->tryParseCosts($costs);
}

/**
* Try to parse the costs.
*/
protected function tryParseCosts($costs)
{
try {
return json_decode($costs, true);
} catch (\Exception $e) {
return null;
}
}
4 replies
FFilament
Created by kekitek on 6/14/2024 in #❓┊help
Import action make field nullable does not work
Thanks solved it like so
protected function beforeValidate(): void
{
$this->data['follow_up'] = $this->parseFollowUp($this->data['follow_up']);
}

/**
* Parse the follow up date.
*/
protected function parseFollowUp($followUp)
{
if (empty($followUp)) {
return null;
}

try {
return Carbon::parse($followUp)->getTimestamp();
} catch (\Exception $e) {
return null;
}
}
protected function beforeValidate(): void
{
$this->data['follow_up'] = $this->parseFollowUp($this->data['follow_up']);
}

/**
* Parse the follow up date.
*/
protected function parseFollowUp($followUp)
{
if (empty($followUp)) {
return null;
}

try {
return Carbon::parse($followUp)->getTimestamp();
} catch (\Exception $e) {
return null;
}
}
38 replies
FFilament
Created by kekitek on 6/14/2024 in #❓┊help
Import action make field nullable does not work
Will check it later no time at the moment
38 replies
FFilament
Created by kekitek on 6/14/2024 in #❓┊help
Import action make field nullable does not work
Oh wow thanks for your effort
38 replies
FFilament
Created by kekitek on 6/14/2024 in #❓┊help
Import action make field nullable does not work
Thanks I will try this 🙂
38 replies
FFilament
Created by kekitek on 6/14/2024 in #❓┊help
Import action make field nullable does not work
Is there someone else who has an idea how to handle this? Please really need this
38 replies
FFilament
Created by kekitek on 6/14/2024 in #❓┊help
Import action make field nullable does not work
same here
try {
$date = new \DateTime($value);
$newState = $date->getTimestamp();
Log::info('Follow up date: ' . $newState);
} catch (\Exception $e) {
$newState = null;
Log::info('Follow up date: ' . $newState);
}
try {
$date = new \DateTime($value);
$newState = $date->getTimestamp();
Log::info('Follow up date: ' . $newState);
} catch (\Exception $e) {
$newState = null;
Log::info('Follow up date: ' . $newState);
}
38 replies