Merge branch 'fix-invoice-item-create-issue' into 'master'

fix item is not created in invoice->add new item modal

See merge request mohit.panjvani/crater-web!1462
This commit is contained in:
Mohit Panjwani
2022-03-06 06:59:07 +00:00
31 changed files with 212 additions and 119 deletions

View File

@ -6,6 +6,7 @@ use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\UpdateSettingsRequest;
use Crater\Models\Company;
use Crater\Models\CompanySetting;
use Illuminate\Support\Arr;
class UpdateCompanySettingsController extends Controller
{
@ -20,10 +21,13 @@ class UpdateCompanySettingsController extends Controller
$company = Company::find($request->header('company'));
$this->authorize('manage company', $company);
$companyCurrency = CompanySetting::getSetting('currency', $request->header('company'));
$data = $request->settings;
if ($companyCurrency !== $data['currency'] && $company->hasTransactions()) {
if (
Arr::exists($data, 'currency') &&
(CompanySetting::getSetting('currency', $company->id) !== $data['currency']) &&
$company->hasTransactions()
) {
return response()->json([
'success' => false,
'message' => 'Cannot update company currency after transactions are created.'

View File

@ -61,13 +61,14 @@
<BaseMultiselect
v-model="taxes"
:options="getTaxTypes"
label="name"
mode="tags"
label="tax_name"
value-prop="id"
class="w-full"
:can-deselect="false"
:can-clear="false"
searchable
track-by="name"
track-by="tax_name"
object
/>
</BaseInputGroup>

View File

@ -83,7 +83,7 @@
? notification.message
: success
? 'Successful'
: 'Somthing went wrong'
: 'Something went wrong'
}}
</p>
</div>

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item Title",
"description": "Description",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Opakující se faktura úspěšně naklonována",
"clone_invoice": "Naklonovat opakující se fakturu",
"confirm_clone": "Tato opakující se faktura bude naklonována do nové opakující se faktury",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Název položky",
"description": "Popis",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Serienrechnung erfolgreich kopiert",
"clone_invoice": "Serienrechnung kopieren",
"confirm_clone": "Diese Serienrechnung wird in eine neue Serienrechnung kopiert",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Titel des Artikels",
"description": "Beschreibung",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Επαναλαμβανόμενο τιμολόγιο κλωνοποιήθηκε επιτυχής",
"clone_invoice": "Δημιουργία Επαναλαμβανόμενου Τιμολογίου",
"confirm_clone": "Αυτό το επαναλαμβανόμενο τιμολόγιο θα κλωνοποιηθεί σε ένα νέο επαναλαμβανόμενο τιμολόγιο",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Τίτλος Προϊόντος",
"description": "Περιγραφή",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Factura recurrente clonada con éxito",
"clone_invoice": "Clonar factura recurrente",
"confirm_clone": "Esta factura recurrente será clonada en una nueva factura recurrente",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Título del artículo",
"description": "Descripción",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item Title",
"description": "Description",

View File

@ -4,7 +4,7 @@
"customers": "Asiakkaat",
"items": "Tuotteet",
"invoices": "Laskut",
"recurring-invoices": "Recurring Invoices",
"recurring-invoices": "Toistuvat laskut",
"expenses": "Kulut",
"estimates": "Tarjoukset",
"payments": "Maksut",
@ -12,7 +12,7 @@
"settings": "Asetukset",
"logout": "Kirjaudu ulos",
"users": "Käyttäjät",
"modules": "Modules"
"modules": "Moduulit"
},
"general": {
"add_company": "Lisää Yritys",
@ -29,9 +29,9 @@
"to_date": "Päivään",
"from": "Lähettäjä",
"to": "Vastaanottaja",
"ok": "Ok",
"yes": "Yes",
"no": "No",
"ok": "OK",
"yes": "Kyllä",
"no": "Ei",
"sort_by": "Järjestä",
"ascending": "Nouseva",
"descending": "Laskeva",
@ -39,7 +39,7 @@
"body": "Sisältö",
"message": "Viesti",
"send": "Lähetä",
"preview": "Preview",
"preview": "Esikatselu",
"go_back": "Palaa takaisin",
"back_to_login": "Takaisin sisäänkirjautumiseen?",
"home": "Koti",
@ -65,7 +65,7 @@
"sent": "Lähetetty",
"all": "Kaikki",
"select_all": "Valitse kaikki",
"select_template": "Select Template",
"select_template": "Valitse Malli",
"choose_file": "Klikkaa tästä valitaksesi tiedoston",
"choose_template": "Valitse pohja",
"choose": "Valitse",
@ -76,7 +76,7 @@
"are_you_sure": "Oletko varma?",
"list_is_empty": "Lista on tyhjä.",
"no_tax_found": "Verokantoja ei löytynyt!",
"four_zero_four": "404",
"four_zero_four": "404 - Sivua ei löydy",
"you_got_lost": "Oho! Taisit eksyä!",
"go_home": "Palaa kotisivulle",
"test_mail_conf": "Testi sähköposti asetukset",
@ -92,12 +92,12 @@
"choose_note": "Valitse viesti",
"no_note_found": "Viestejä ei löytynyt",
"insert_note": "Lisää viesti",
"copied_pdf_url_clipboard": "Copied PDF url to clipboard!",
"copied_url_clipboard": "Copied url to clipboard!",
"docs": "Docs",
"do_you_wish_to_continue": "Do you wish to continue?",
"note": "Note",
"pay_invoice": "Pay Invoice",
"copied_pdf_url_clipboard": "Kopioitu PDF url leikepöydälle!",
"copied_url_clipboard": "URL-osoite kopioitu leikepöydälle!",
"docs": "Asiakirjat",
"do_you_wish_to_continue": "Haluatko jatkaa?",
"note": "Viesti",
"pay_invoice": "Maksa Lasku",
"login_successfully": "Logged in successfully!",
"logged_out_successfully": "Logged out successfully",
"mark_as_default": "Mark as default"
@ -421,7 +421,7 @@
"select_invoice": "Valitse lasku",
"no_matching_invoices": "Vastaavia laskuja ei ole!",
"mark_as_sent_successfully": "Lasku merkitty lähetetyksi onnistuneesti",
"invoice_sent_successfully": "Invoice sent successfully",
"invoice_sent_successfully": "Lasku lähetettiin onnistuneesti",
"cloned_successfully": "Lasku kopioitu onnistuneesti",
"clone_invoice": "Kopioi lasku",
"confirm_clone": "Tämä lasku kopioidaan uudeksi laskuksi",
@ -447,57 +447,57 @@
"marked_as_sent_message": "Lasku merkittiin lähetetyksi onnistuneesti",
"something_went_wrong": "jotain meni vikaan",
"invalid_due_amount_message": "Laskun summa ei voi olla pienempi kuin maksettu summa laskusta. Päivitä lasku tai poista linkitetty maksusuoritus jatkaaksesi.",
"mark_as_default_invoice_template_description": "If enabled, the selected template will be automatically selected for new invoices."
"mark_as_default_invoice_template_description": "Jos käytössä, valittu malli valitaan automaattisesti uusille laskuille."
},
"recurring_invoices": {
"title": "Recurring Invoices",
"invoices_list": "Recurring Invoices List",
"days": "{days} Days",
"months": "{months} Month",
"years": "{years} Year",
"all": "All",
"paid": "Paid",
"unpaid": "Unpaid",
"viewed": "Viewed",
"overdue": "Overdue",
"active": "Active",
"completed": "Completed",
"customer": "CUSTOMER",
"paid_status": "PAID STATUS",
"ref_no": "REF NO.",
"number": "NUMBER",
"amount_due": "AMOUNT DUE",
"partially_paid": "Partially Paid",
"total": "Total",
"discount": "Discount",
"sub_total": "Sub Total",
"invoice": "Recurring Invoice | Recurring Invoices",
"invoice_number": "Recurring Invoice Number",
"next_invoice_date": "Next Invoice Date",
"ref_number": "Ref Number",
"contact": "Contact",
"add_item": "Add an Item",
"date": "Date",
"limit_by": "Limit by",
"limit_date": "Limit Date",
"limit_count": "Limit Count",
"count": "Count",
"status": "Status",
"select_a_status": "Select a status",
"working": "Working",
"on_hold": "On Hold",
"complete": "Completed",
"add_tax": "Add Tax",
"amount": "Amount",
"action": "Action",
"notes": "Notes",
"view": "View",
"basic_info": "Basic Info",
"send_invoice": "Send Recurring Invoice",
"auto_send": "Auto Send",
"resend_invoice": "Resend Recurring Invoice",
"invoice_template": "Recurring Invoice Template",
"conversion_message": "Recurring Invoice cloned successful",
"title": "Toistuvat laskut",
"invoices_list": "Toistuvien laskujen luettelo",
"days": "{days} Päivät",
"months": "{months} Kuukaudet",
"years": "{years} Vuodet",
"all": "Kaikki",
"paid": "Maksettu",
"unpaid": "Maksamattomat",
"viewed": "Katsottu",
"overdue": "Erääntyneet",
"active": "Aktiivinen",
"completed": "Valmis",
"customer": "Asiakas",
"paid_status": "MAKSUN TILA",
"ref_no": "Viitteemme",
"number": "NUMERO",
"amount_due": "AVOIN SAATAVA",
"partially_paid": "Osittain maksettu",
"total": "Yhteensä",
"discount": "Alennus",
"sub_total": "Välisumma",
"invoice": "Toistuva Lasku - Toistuvat Laskut",
"invoice_number": "Toistuva Laskun Numero",
"next_invoice_date": "Seuraava Laskun Päivämäärä",
"ref_number": "Asiakkaan viite",
"contact": "Yhteyshenkilö",
"add_item": "Lisää tuote",
"date": "Päiväys",
"limit_by": "Rajoita",
"limit_date": "Rajoita Päivämäärä",
"limit_count": "Rajoita määrää",
"count": "Määrä",
"status": "Tila",
"select_a_status": "Valitse tila",
"working": "Käynnissä",
"on_hold": "Pidossa",
"complete": "Valmis",
"add_tax": "Lisää Verokanta",
"amount": "Määrä",
"action": "Toiminta",
"notes": "Viesti",
"view": "Katsele",
"basic_info": "Perustiedot",
"send_invoice": "Lähetä Toistuva Lasku",
"auto_send": "Automaattinen Lähetys",
"resend_invoice": "Lähetä Uudelleen Toistuva Lasku",
"invoice_template": "Toistuva Laskun Malli",
"conversion_message": "Toistuva lasku kopioitu onnistuneesti",
"template": "Template",
"mark_as_sent": "Mark as sent",
"confirm_send_invoice": "This recurring invoice will be sent via email to the customer",
@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Ole hyvä ja lisää sähköpostiosoite tälle asiakkaalle voidaksesi lähettää laskut automaattisesti.",
"item": {
"title": "Item Title",
"description": "Description",
@ -552,11 +553,11 @@
"confirm_delete": "You will not be able to recover this Invoice | You will not be able to recover these Invoices",
"created_message": "Recurring Invoice created successfully",
"updated_message": "Recurring Invoice updated successfully",
"deleted_message": "Recurring Invoice deleted successfully | Recurring Invoices deleted successfully",
"marked_as_sent_message": "Recurring Invoice marked as sent successfully",
"user_email_does_not_exist": "User email does not exist",
"something_went_wrong": "something went wrong",
"invalid_due_amount_message": "Total Recurring Invoice amount cannot be less than total paid amount for this Recurring Invoice. Please update the invoice or delete the associated payments to continue."
"deleted_message": "Toistuva lasku poistettiin onnistuneesti. Toistuvien laskujen poistaminen onnistui",
"marked_as_sent_message": "Toistuva lasku merkitty lähetetyksi onnistuneesti",
"user_email_does_not_exist": "Käyttäjän sähköposti ei ole määritetty",
"something_went_wrong": "jotain meni vikaan",
"invalid_due_amount_message": "Toistuvan laskun kokonaissumma ei voi olla pienempi kuin tälle toistuvalle laskulle maksettu summa. Päivitä lasku tai poista niihin liittyvät maksut jatkaaksesi."
},
"payments": {
"title": "Maksut",
@ -581,8 +582,8 @@
"update_payment": "Päivitä maksu",
"payment": "Maksu | Maksut",
"no_payments": "Ei tallennettuja maksuja!",
"not_selected": "Not selected",
"no_invoice": "No invoice",
"not_selected": "Ei valittu",
"no_invoice": "Ei laskua",
"no_matching_payments": "Vastaavia maksuja ei ole!",
"list_of_payments": "Tämä osio sisältää luettelon maksuista.",
"select_payment_mode": "Valitse maksutapa",
@ -602,7 +603,7 @@
"select_a_customer": "Valitse asiakas",
"expense_title": "Otsikko",
"customer": "Asiakas",
"currency": "Currency",
"currency": "Valuutta",
"contact": "Yhteyshenkilö",
"category": "Luokka",
"from_date": "Päivästä",
@ -612,7 +613,7 @@
"receipt": "Kuitti",
"amount": "Summa",
"action": "Toiminta",
"not_selected": "Not selected",
"not_selected": "Ei valittu",
"note": "viesti",
"category_id": "Luokan tunnus",
"date": "Päivämäärä",
@ -657,48 +658,48 @@
"retype_password": "Kirjoita salasana uudelleen"
},
"modules": {
"buy_now": "Buy Now",
"install": "Install",
"price": "Price",
"download_zip_file": "Download ZIP file",
"unzipping_package": "Unzipping Package",
"copying_files": "Copying Files",
"deleting_files": "Deleting Unused files",
"completing_installation": "Completing Installation",
"update_failed": "Update Failed",
"install_success": "Module has been installed successfully!",
"customer_reviews": "Reviews",
"license": "License",
"faq": "FAQ",
"monthly": "Monthly",
"yearly": "Yearly",
"updated": "Updated",
"version": "Version",
"disable": "Disable",
"module_disabled": "Module Disabled",
"enable": "Enable",
"module_enabled": "Module Enabled",
"update_to": "Update To",
"module_updated": "Module Updated Successfully!",
"title": "Modules",
"module": "Module | Modules",
"api_token": "API token",
"invalid_api_token": "Invalid API Token.",
"other_modules": "Other Modules",
"view_all": "View All",
"no_reviews_found": "There are no reviews for this module yet!",
"module_not_purchased": "Module Not Purchased",
"module_not_found": "Module Not Found",
"buy_now": "Osta Nyt",
"install": "Asenna",
"price": "Hinta",
"download_zip_file": "Lataa ZIP tiedosto",
"unzipping_package": "Puretaan pakettia",
"copying_files": "Kopioidaan tiedostoja",
"deleting_files": "Käyttämättömiä tiedostoja poistetaan",
"completing_installation": "Viimeistellään Asennusta",
"update_failed": "Päivitys epäonnistui",
"install_success": "Moduuli on asennettu onnistuneesti!",
"customer_reviews": "Arvostelut",
"license": "Lisenssi",
"faq": "UKK",
"monthly": "Kuukausittain",
"yearly": "Vuosittain",
"updated": "Päivitetty",
"version": "Versio",
"disable": "Poista käytöstä",
"module_disabled": "Moduuli poistettu käytöstä",
"enable": "Ota käyttöön",
"module_enabled": "Moduuli on käytössä",
"update_to": "Päivitä ohjelma",
"module_updated": "Moduulin päivitys onnistui!",
"title": "Moduulit",
"module": "Moduuli · Moduulit",
"api_token": "API tunnus",
"invalid_api_token": "Virheellinen API-tunnus.",
"other_modules": "Muut Moduulit",
"view_all": "Näytä kaikki",
"no_reviews_found": "Tällä modulilla ei ole vielä arvosteluita!",
"module_not_purchased": "Moduulia ei ostettu",
"module_not_found": "Moduulia ei löydy",
"version_not_supported": "This module version doesn't support the current version of Crater",
"last_updated": "Last Updated On",
"connect_installation": "Connect your installation",
"api_token_description": "Login to {url} and connect this installation by entering the API Token. Your purchased modules will show up here after the connection is established.",
"view_module": "View Module",
"update_available": "Update Available",
"purchased": "Purchased",
"installed": "Installed",
"no_modules_installed": "No Modules Installed Yet!",
"disable_warning": "All the settings for this particular will be reverted.",
"last_updated": "Viimeksi päivitetty",
"connect_installation": "Yhdistä asennuksesi",
"api_token_description": "Kirjaudu sisään {url} ja yhdistä tämä asennus syöttämällä API tunnus. Ostetut moduulit näkyvät täällä kun yhteys on luotu.",
"view_module": "Näytä Moduuli",
"update_available": "Päivitys saatavilla",
"purchased": "Ostetut",
"installed": "Asennetut",
"no_modules_installed": "Ei Asennettuja Moduuleja!",
"disable_warning": "Kaikki tämän nimenomaisen asetuksen tiedot peruutetaan.",
"what_you_get": "What you get"
},
"users": {

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Facture récurrente clonée",
"clone_invoice": "Dupliquer",
"confirm_clone": "Cette facture récurrente sera clonée dans une nouvelle facture récurrente",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Nom",
"description": "Description",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item Title",
"description": "Description",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item Title",
"description": "Description",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Faktur Berulang berhasil digandakan",
"clone_invoice": "Gandakan Faktur Berulang",
"confirm_clone": "Faktur Berulang ini akan digandakan menjadi Faktur Berulang yang baru",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Judul item",
"description": "Deskripsi",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Fattura copiata con successo",
"clone_invoice": "Duplica Fattura Ricorrente",
"confirm_clone": "Questa fattura ricorrente verrà clonata in una nuova fattura ricorrente",
"add_customer_email": "Inserisci una E-Mail per inviare automaticamente fatture al cliente.",
"item": {
"title": "Titolo Articolo",
"description": "Descrizione",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item Title",
"description": "Description",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item Title",
"description": "Description",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item Title",
"description": "Description",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Terugkerende factuur succesvol gekopieerd",
"clone_invoice": "Kopieer periodieke factuur",
"confirm_clone": "Deze periodieke factuur wordt gekopieerd naar een nieuwe periodieke factuur",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item titel",
"description": "Beschrijving",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Faktura Cykliczna sklonowana pomyślnie",
"clone_invoice": "Klonuj Fakturę Cykliczną",
"confirm_clone": "Ta faktura cykliczna zostanie sklonowana do nowej faktury cyklicznej",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Tytuł pozycji",
"description": "Opis",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item Title",
"description": "Description",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item Title",
"description": "Description",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item Title",
"description": "Description",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item Title",
"description": "Description",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item Title",
"description": "Description",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item Title",
"description": "Description",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item Title",
"description": "Description",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item Title",
"description": "Description",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Thêm một địa chỉ email cho khách hàng này để gửi hóa đơn tự động.",
"item": {
"title": "Item Title",
"description": "Description",

View File

@ -526,6 +526,7 @@
"cloned_successfully": "Recurring Invoice cloned successfully",
"clone_invoice": "Clone Recurring Invoice",
"confirm_clone": "This recurring invoice will be cloned into a new Recurring Invoice",
"add_customer_email": "Please add an email address for this customer to send invoices automatically.",
"item": {
"title": "Item Title",
"description": "Description",

View File

@ -3,6 +3,9 @@
use Crater\Http\Controllers\V1\Admin\Settings\CompanyController;
use Crater\Http\Requests\CompanyRequest;
use Crater\Http\Requests\ProfileRequest;
use Crater\Models\Invoice;
use Crater\Models\InvoiceItem;
use Crater\Models\Tax;
use Crater\Models\User;
use Illuminate\Support\Facades\Artisan;
use Laravel\Sanctum\Sanctum;
@ -120,6 +123,64 @@ test('update settings', function () {
}
});
test('update settings without currency setting', function () {
$settings = [
'notification_email' => 'noreply@crater.in',
];
$response = postJson('/api/v1/company/settings', ['settings' => $settings]);
$response->assertOk()
->assertJson([
'success' => true,
]);
foreach ($settings as $key => $value) {
$this->assertDatabaseHas('company_settings', [
'option' => $key,
'value' => $value,
]);
}
});
test('update currency settings after company has currency and transactions is not allowed', function () {
$settings = [
'currency' => 1,
];
$response = postJson('/api/v1/company/settings', ['settings' => $settings]);
$response->assertOk()
->assertJson([
'success' => true,
]);
Invoice::factory()
->raw([
'taxes' => [Tax::factory()->raw()],
'items' => [InvoiceItem::factory()->raw()],
]);
$settings = [
'currency' => 2,
];
$response = postJson('/api/v1/company/settings', ['settings' => $settings]);
$response->assertOK()
->assertJson([
'success' => false,
'message' => 'Cannot update company currency after transactions are created.'
]);
$this->assertDatabaseHas('company_settings', [
'option' => 'currency',
'value' => 1,
]);
});
test('get notification email settings', function () {
$data['settings'] = [
'currency',