{"size": 7155, "ext": "js", "max_stars_repo_path": "script.js", "max_stars_repo_name": "PedroNestor2077/tiktimWeb", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "script.js", "max_issues_repo_name": "PedroNestor2077/tiktimWeb", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "script.js", "max_forks_repo_name": "PedroNestor2077/tiktimWeb", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 39.3131868132, "max_line_length": 126, "alphanum_fraction": 0.6925227114}
const calcChicken = (carne, limpeza, caixas) =>
{
    const $alhoQNT = 8, $salQNT = 16, $peitoQNT = 0.2, $baconQNT = 0.13, $carne = carne / caixas, $limpeza = limpeza / caixas;

    const $peito = $carne * $peitoQNT;
    const $bacon = ($carne + $peito) * $baconQNT;
    const $alho = ($carne + $peito + $limpeza) * $alhoQNT;
    const $sal = ($carne + $peito + $limpeza) * $salQNT;
    const $total = ($carne + $peito + $limpeza + $bacon);

    const $carneCell = document.getElementById('carne');
    const $peitoCell = document.getElementById('peito');
    const $limpezaCell = document.getElementById('limpeza');
    const $baconCell = document.getElementById('bacon');
    const $alhoCell = document.getElementById('alho');
    const $salCell = document.getElementById('sal');
    const $totalCell = document.getElementById('total');

    $carneCell.innerText = $carne.toFixed(2);
    $peitoCell.innerText = $peito.toFixed(2);
    $limpezaCell.innerText = $limpeza.toFixed(2);
    $baconCell.innerText = $bacon.toFixed(2);
    $alhoCell.innerText = $alho.toFixed(2);
    $salCell.innerText = $sal.toFixed(2);
    $totalCell.innerText = $total.toFixed(2);
    $tableHeader.innerText = 'Receita de frango';
    $caixasInfo.innerText = "Total de caixas: " + caixas

}

const calcPorco = (carne, limpeza, caixas) =>
{
    const $alhoQNT = 8, $salQNT = 16, $carne = carne / caixas, $limpeza = limpeza / caixas, $toucinhoQNT = 0.3;
    const $toucinho = $carne * $toucinhoQNT;
    const $alho = ($carne + $limpeza + $toucinho) * $alhoQNT;
    const $sal = ($carne + $limpeza + $toucinho) * $salQNT;
    const $total = ($carne + $limpeza + $toucinho);

    const $carneCell = document.getElementById('carnePorco');
    const $limpezaCell = document.getElementById('limpezaPorco');
    const $toucinhoCell = document.getElementById('toucinhoPorco');
    const $alhoCell = document.getElementById('alhoPorco');
    const $salCell = document.getElementById('salPorco');
    const $totalCell = document.getElementById('totalPorco')

    $carneCell.innerText = ($carne).toFixed(2) + 'kg';
    $limpezaCell.innerText = ($limpeza).toFixed(2) + 'kg';
    $toucinhoCell.innerText = ($toucinho).toFixed(2) + 'kg';
    $alhoCell.innerText = ($alho).toFixed(2) + 'g';
    $salCell.innerText = ($sal).toFixed(2) + 'g';
    $totalCell.innerText = ($total).toFixed(2) + 'kg'
    $tableHeaderPorco.innerText = "Receita de Porco";
    $caixasInfoPorco.innerText = 'Total de caixas: ' + caixas

}

const doSubmit = (event) =>
{
    event.preventDefault()
    const $carneInput = document.getElementById('carneInput').value;
    const $limpezaInput = document.getElementById('limpezaInput').value;
    const $caixasInput = document.getElementById('caixasInput').value;
    const $select = document.getElementById('select').value;
    if ($select == 'porco') {
        $contentPorco.style.display = 'flex';
        calcPorco($carneInput, $limpezaInput, $caixasInput)
    } else {
        $contentPage.style.display = 'flex';
        calcChicken($carneInput, $limpezaInput, $caixasInput)
    }

};
const $form = document.getElementsByClassName('form')[0];
$form.addEventListener('submit', doSubmit);


const $contentPage = document.getElementsByClassName('contentPage')[0];
const $contentPorco = document.getElementById('contentPorco');

$contentPage.style.display = 'none';
$contentPorco.style.display = 'none';

const $backButtonFrango = document.getElementsByClassName('backButton')[0];
const $backButtonPorco = document.getElementsByClassName('backButton')[1];

$backButtonFrango.addEventListener('click', () => { $contentPage.style.display = 'none' })

$backButtonPorco.addEventListener('click', () => { $contentPorco.style.display = 'none' })

const $tableHeader = document.getElementsByClassName('tableHeader')[0];
const $caixasInfo = document.getElementsByClassName('caixasInfo')[0];

const $tableHeaderPorco = document.getElementsByClassName('tableHeaderPorco')[0];
const $caixasInfoPorco = document.getElementsByClassName('caixasInfoPorco')[0];


const $frangoResult = document.getElementById('frangoResult');


// FRANGO INPUT EVENT LISTNERS-------------

const $paiolInput = document.getElementById('paiolInput');
const $tomateInput = document.getElementById('tomateInput');
const $cheddarInput = document.getElementById('cheddarInput');
const $apimentadaInput = document.getElementById('apimentadaInput');
const $racaInput = document.getElementById('rocaInput');
const $provoloneInput = document.getElementById('provoloneInput');
const $ruculaInput = document.getElementById('ruculaInput');
const $jiloInput = document.getElementById('jiloInput');



$paiolInput.addEventListener('change', (event) =>
{
    const $mihloCell = document.getElementById('paiolMilho');
    const $requeijaoCell = document.getElementById('paiolRequeijao');
    const $inputValue = event.target.value;
    $mihloCell.innerText = ($inputValue * 0.150).toFixed(2) + "kg";
    $requeijaoCell.innerText = ($inputValue * 0.2).toFixed(2) + "kg";

})
$tomateInput.addEventListener('change', (event) =>
{
    const $tomateCell = document.getElementById('tomate');
    const $requeijaoCell = document.getElementById('tomateRequeijao');
    const $inputValue = event.target.value;
    $tomateCell.innerText = ($inputValue * 0.1).toFixed(2) + 'kg';
    $requeijaoCell.innerText = ($inputValue * 0.2).toFixed(2) + "kg";
})

$cheddarInput.addEventListener('change', (event) =>
{
    const $chaddarCell = document.getElementById('cheddarCell');
    const $inputValue = event.target.value;
    $chaddarCell.innerText = ($inputValue * 0.2).toFixed(2);
})

$apimentadaInput.addEventListener('change', (event) =>
{
    const $pimnetaCell = document.getElementById('pimenta');
    const $inputValue = event.target.value;
    $pimnetaCell.innerText = ($inputValue * 12.5).toFixed(2) + "g";

})

$racaInput.addEventListener('change', (event) =>
{
    const $pimnetaCell = document.getElementById('rocaPimenta');
    const $salcinhaCell = document.getElementById('salsinha');
    const $inputValue = event.target.value;
    $pimnetaCell.innerText = ($inputValue * 2.5).toFixed(2) + "g";
    $salcinhaCell.innerText = ($inputValue * 20).toFixed(2) + 'g';

})

$provoloneInput.addEventListener('change', (event) =>
{
    const $provoloneCell = document.getElementById('provolone');
    const $inputValue = event.target.value;
    $provoloneCell.innerText = ($inputValue * 0.2).toFixed(2) + "kg";

})

$ruculaInput.addEventListener('change', (event) =>
{
    const $ruculaCell = document.getElementById('rucula');
    const $queijoCell = document.getElementById('queijoCoalho');
    const $inputValue = event.target.value;
    $ruculaCell.innerText = ($inputValue * 0.1).toFixed(2) + "kg";
    $queijoCell.innerText = ($inputValue * 0.2).toFixed(2) + "kg";

})

$jiloInput.addEventListener('change', (event) =>
{
    const $jiloCell = document.getElementById('jilo');
    const $pimentaCell = document.getElementById('jiloPimenta');
    const $inputValue = event.target.value;
    $jiloCell.innerText = ($inputValue * 0.13).toFixed(2) + "kg";
    $pimentaCell.innerText = ($inputValue * 2.5).toFixed(2) + "g";

})