mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
Compare commits
7 Commits
5.0.6
...
increase-s
| Author | SHA1 | Date | |
|---|---|---|---|
| d2dcc44817 | |||
| 4a85a5d2ab | |||
| 7f04781604 | |||
| 99b1cc80c6 | |||
| 6ce74bd59f | |||
| b24350aba6 | |||
| b770e6277f |
@ -183,7 +183,7 @@ class Payment extends Model implements HasMedia
|
||||
|
||||
public function updatePayment($request)
|
||||
{
|
||||
$data = $request->all();
|
||||
$data = $request->getPaymentPayload();
|
||||
|
||||
if ($request->invoice_id && (! $this->invoice_id || $this->invoice_id !== $request->invoice_id)) {
|
||||
$invoice = Invoice::find($request->invoice_id);
|
||||
|
||||
@ -156,7 +156,7 @@ class SerialNumberFormatter
|
||||
|
||||
public static function getPlaceholders(string $format)
|
||||
{
|
||||
$regex = "/{{([A-Z_]{1,})(?::)?([a-zA-Z0-9_]{1,4}|.{1})?}}/";
|
||||
$regex = "/{{([A-Z_]{1,})(?::)?([a-zA-Z0-9_]{1,6}|.{1})?}}/";
|
||||
|
||||
preg_match_all($regex, $format, $placeholders);
|
||||
array_shift($placeholders);
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Crater\Models\Payment;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CalculateBaseAmountOfPaymentsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$payments = Payment::all();
|
||||
|
||||
if ($payments) {
|
||||
foreach ($payments as $payment) {
|
||||
$payment->base_amount = $payment->exchange_rate * $payment->amount;
|
||||
$payment->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@ -861,7 +861,7 @@
|
||||
"component": "Component",
|
||||
"Parameter": "Parameter",
|
||||
"series": "Series",
|
||||
"series_description": "To set a static prefix/postfix like 'INV' across your company. It supports character length of up to 4 chars.",
|
||||
"series_description": "To set a static prefix/postfix like 'INV' across your company. It supports character length of up to 6 chars.",
|
||||
"series_param_label": "Series Value",
|
||||
"delimiter": "Delimiter",
|
||||
"delimiter_description": "Single character for specifying the boundary between 2 separate components. By default its set to -",
|
||||
@ -870,7 +870,7 @@
|
||||
"date_format_description": "A local date and time field which accepts a format parameter. The default format: 'Y' renders the current year.",
|
||||
"date_format_param_label": "Format",
|
||||
"sequence": "Sequence",
|
||||
"sequence_description": "Consecutive sequence of numbers across your company. You can specify the length on the given paramter.",
|
||||
"sequence_description": "Consecutive sequence of numbers across your company. You can specify the length on the given parameter.",
|
||||
"sequence_param_label": "Sequence Length",
|
||||
"customer_series": "Customer Series",
|
||||
"customer_series_description": "To set a different prefix/postfix for each customer.",
|
||||
@ -878,7 +878,7 @@
|
||||
"customer_sequence_description": "Consecutive sequence of numbers for each of your customer.",
|
||||
"customer_sequence_param_label": "Sequence Length",
|
||||
"random_sequence": "Random Sequence",
|
||||
"random_sequence_description": "Random alphanumeric string. You can specify the length on the given paramter.",
|
||||
"random_sequence_description": "Random alphanumeric string. You can specify the length on the given parameter.",
|
||||
"random_sequence_param_label": "Sequence Length",
|
||||
"invoices": {
|
||||
"title": "Invoices",
|
||||
|
||||
@ -185,6 +185,10 @@
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #cell-expense_date="{ row }">
|
||||
{{ row.data.formatted_expense_date }}
|
||||
</template>
|
||||
|
||||
<template #cell-user_name="{ row }">
|
||||
<BaseText
|
||||
:text="row.data.customer ? row.data.customer.name : '-'"
|
||||
|
||||
@ -151,6 +151,10 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #cell-payment_date="{ row }">
|
||||
{{ row.data.formatted_payment_date }}
|
||||
</template>
|
||||
|
||||
<template #cell-payment_number="{ row }">
|
||||
<router-link
|
||||
:to="{ path: `payments/${row.data.id}/view` }"
|
||||
@ -161,11 +165,7 @@
|
||||
</template>
|
||||
|
||||
<template #cell-name="{ row }">
|
||||
<BaseText
|
||||
:text="row.data.customer.name"
|
||||
:length="30"
|
||||
tag="span"
|
||||
/>
|
||||
<BaseText :text="row.data.customer.name" :length="30" tag="span" />
|
||||
</template>
|
||||
|
||||
<template #cell-payment_mode="{ row }">
|
||||
|
||||
@ -163,7 +163,7 @@
|
||||
>
|
||||
<div class="flex-2">
|
||||
<BaseText
|
||||
:text="payment?.customer?.name "
|
||||
:text="payment?.customer?.name"
|
||||
:length="30"
|
||||
class="
|
||||
pr-2
|
||||
@ -219,11 +219,11 @@
|
||||
text-right text-gray-900
|
||||
"
|
||||
:amount="payment?.amount"
|
||||
:currency="payment?.currency"
|
||||
:currency="payment.customer.currency"
|
||||
/>
|
||||
|
||||
<div class="text-sm text-right text-gray-500 non-italic">
|
||||
{{ paymentDate }}
|
||||
{{ payment.formatted_payment_date }}
|
||||
</div>
|
||||
</div>
|
||||
</router-link>
|
||||
|
||||
@ -386,8 +386,8 @@ function removeComponent(component) {
|
||||
function onUpdate(val, element) {
|
||||
switch (element.name) {
|
||||
case 'SERIES':
|
||||
if (val.length >= 4) {
|
||||
val = val.substring(0, 4)
|
||||
if (val.length >= 6) {
|
||||
val = val.substring(0, 6)
|
||||
}
|
||||
break
|
||||
case 'DELIMITER':
|
||||
|
||||
@ -23,52 +23,3 @@ test('get all used currencies', function () {
|
||||
getJson("/api/v1/currencies/used")
|
||||
->assertOk();
|
||||
});
|
||||
|
||||
test('get supported currencies of currency freak', function () {
|
||||
$driver = [
|
||||
'driver' => "currency_freak",
|
||||
'key' => "9ab5bc6424604778ad61103b628518f8"
|
||||
];
|
||||
|
||||
$queryString = http_build_query($driver, '', '&');
|
||||
|
||||
getJson("/api/v1/supported-currencies?".$queryString)
|
||||
->assertOk();
|
||||
});
|
||||
|
||||
test('get supported currencies of currency layer', function () {
|
||||
$driver = [
|
||||
'driver' => "currency_layer",
|
||||
'key' => "2bb7a25e6f24f42a66fde1f57b5210fd"
|
||||
];
|
||||
|
||||
$queryString = http_build_query($driver, '', '&');
|
||||
|
||||
getJson("/api/v1/supported-currencies?".$queryString)
|
||||
->assertOk();
|
||||
});
|
||||
|
||||
test('get supported currencies of open exchange rate', function () {
|
||||
$driver = [
|
||||
'driver' => "open_exchange_rate",
|
||||
'key' => "c5f404d414d245209923cd4f2d4c3875"
|
||||
];
|
||||
|
||||
$queryString = http_build_query($driver, '', '&');
|
||||
|
||||
getJson("/api/v1/supported-currencies?".$queryString)
|
||||
->assertOk();
|
||||
});
|
||||
|
||||
test('get supported currencies of currency converter', function () {
|
||||
$driver = [
|
||||
'driver' => "currency_converter",
|
||||
'key' => "0a1cef4d5f6fd01cc87a",
|
||||
'type' => 'FREE'
|
||||
];
|
||||
|
||||
$queryString = http_build_query($driver, '', '&');
|
||||
|
||||
getJson("/api/v1/supported-currencies?".$queryString)
|
||||
->assertOk();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user