Explorar el Código

Add "Nickname" field; remove "Fax" field from UI

Alan Lam hace 2 años
padre
commit
8f1c318919

+ 0 - 1
controllers/company_form.php

@@ -44,7 +44,6 @@ if($submit) {
 
 
 		$company->name = $request->string("name");
 		$company->name = $request->string("name");
 		$company->phone = $request->string("phone");
 		$company->phone = $request->string("phone");
-		$company->fax = $request->string("fax");
 		$company->email = $request->email("email");
 		$company->email = $request->email("email");
 		$company->company_number = $request->string("company_number");
 		$company->company_number = $request->string("company_number");
 		$company->vat_number = $request->string("vat_number");
 		$company->vat_number = $request->string("vat_number");

+ 0 - 1
controllers/location_form.php

@@ -37,7 +37,6 @@ else {
 		$location->customer_id = $customer_id;
 		$location->customer_id = $customer_id;
 		$location->name = $customer->name;
 		$location->name = $customer->name;
 		$location->phone = $customer->phone;
 		$location->phone = $customer->phone;
-		$location->fax = $customer->fax;
 		$location->email = $customer->email;
 		$location->email = $customer->email;
 
 
 		$core->addBreadcrumb($customer->getUrl(), $customer->name);
 		$core->addBreadcrumb($customer->getUrl(), $customer->name);

+ 0 - 1
controllers/supplier_form.php

@@ -44,7 +44,6 @@ if($submit) {
 
 
 		$supplier->name = $request->string("name");
 		$supplier->name = $request->string("name");
 		$supplier->phone = $request->string("phone");
 		$supplier->phone = $request->string("phone");
-		$supplier->fax = $request->string("fax");
 		$supplier->email = $request->email("email");
 		$supplier->email = $request->email("email");
 
 
 		$address->address_1 = $request->string("address_1");
 		$address->address_1 = $request->string("address_1");

+ 12 - 0
db/migrations/20240228203419_add_nickname_field_to_location_table.php

@@ -0,0 +1,12 @@
+<?php
+declare(strict_types=1);
+
+use Phinx\Migration\AbstractMigration;
+
+final class AddNicknameFieldToLocationTable extends AbstractMigration {
+	public function change(): void {
+		$this->table("location")
+			->addColumn("nickname", "string", ["after" => "name", "null" => true])
+			->update();
+	}
+}

+ 0 - 1
engine/Customer.php

@@ -54,7 +54,6 @@ class Customer extends Model {
 
 
 		$customer->name = $request->string("name");
 		$customer->name = $request->string("name");
 		$customer->phone = $request->string("phone");
 		$customer->phone = $request->string("phone");
-		$customer->fax = $request->string("fax");
 		$customer->email = $request->email("email");
 		$customer->email = $request->email("email");
 		$customer->vat_number = $request->string("vat_number");
 		$customer->vat_number = $request->string("vat_number");
 
 

+ 3 - 2
engine/Location.php

@@ -14,6 +14,7 @@ use RuntimeException;
  * @property int $customer_id
  * @property int $customer_id
  * @property int $address_id
  * @property int $address_id
  * @property string $name
  * @property string $name
+ * @property string $nickname
  * @property string $phone
  * @property string $phone
  * @property string $fax
  * @property string $fax
  * @property string $email
  * @property string $email
@@ -28,7 +29,7 @@ class Location extends Model {
 	protected static $idField = "id";
 	protected static $idField = "id";
 	protected static $fillableFields = [
 	protected static $fillableFields = [
 		"customer_id", "address_id",
 		"customer_id", "address_id",
-		"name", "phone", "fax", "email",
+		"name", "nickname", "phone", "fax", "email",
 		"contact_name", "contact_phone", "contact_email",
 		"contact_name", "contact_phone", "contact_email",
 		"dts_created", "dts_updated", "dts_deleted"
 		"dts_created", "dts_updated", "dts_deleted"
 	];
 	];
@@ -54,8 +55,8 @@ class Location extends Model {
 
 
 		$location->customer_id = $customer->id;
 		$location->customer_id = $customer->id;
 		$location->name = $request->string("name");
 		$location->name = $request->string("name");
+		$location->nickname = $request->string("nickname");
 		$location->phone = $request->string("phone");
 		$location->phone = $request->string("phone");
-		$location->fax = $request->string("fax");
 		$location->email = $request->email("email");
 		$location->email = $request->email("email");
 
 
 		$location->contact_name = $request->string("contact_name");
 		$location->contact_name = $request->string("contact_name");

+ 0 - 2
views/aru_dn_pdf.php

@@ -293,8 +293,6 @@ $render_card = static function(string $title, ?string $content): void {
 			<strong class="large"><?=htmlspecialchars($company->name)?>, <?=htmlspecialchars(implode(", ", $address_lines))?></strong><br />
 			<strong class="large"><?=htmlspecialchars($company->name)?>, <?=htmlspecialchars(implode(", ", $address_lines))?></strong><br />
 			Tel: <?=htmlspecialchars($company->phone)?>
 			Tel: <?=htmlspecialchars($company->phone)?>
 			<span class="px-1"></span>
 			<span class="px-1"></span>
-			Fax: <?=htmlspecialchars($company->fax)?>
-			<span class="px-1"></span>
 			Email: <?=htmlspecialchars($company->email)?>
 			Email: <?=htmlspecialchars($company->email)?>
 		</div>
 		</div>
 
 

+ 0 - 1
views/companies.php

@@ -67,7 +67,6 @@ else {
 				</td>
 				</td>
 				<td>
 				<td>
 					<i class="fa fa-fw fa-phone"></i> <?=htmlspecialchars($company->phone)?><br />
 					<i class="fa fa-fw fa-phone"></i> <?=htmlspecialchars($company->phone)?><br />
-					<i class="fa fa-fw fa-fax"></i> <?=htmlspecialchars($company->fax)?><br />
 					<i class="fa fa-fw fa-envelope"></i> <?=htmlspecialchars($company->email)?><br />
 					<i class="fa fa-fw fa-envelope"></i> <?=htmlspecialchars($company->email)?><br />
 				</td>
 				</td>
 				<td>
 				<td>

+ 11 - 5
views/entity_form.php

@@ -91,12 +91,18 @@ if($is_location) {
 						<input class="form-control" type="tel" id="phone" name="phone" placeholder="<?=htmlspecialchars(__("Type phone"))?>" value="<?=htmlspecialchars($model->phone)?>" />
 						<input class="form-control" type="tel" id="phone" name="phone" placeholder="<?=htmlspecialchars(__("Type phone"))?>" value="<?=htmlspecialchars($model->phone)?>" />
 					</div>
 					</div>
 				</div>
 				</div>
-				<div class="col-6">
-					<div class="mb-3">
-						<label class="form-label" for="fax"><?=htmlspecialchars(__("Fax"))?></label>
-						<input class="form-control" type="tel" id="fax" name="fax" placeholder="<?=htmlspecialchars(__("Type fax"))?>" value="<?=htmlspecialchars($model->fax)?>" />
+				<?php
+				if($model instanceof Location) {
+					?>
+					<div class="col-6">
+						<div class="mb-3">
+							<label class="form-label" for="nickname"><?=htmlspecialchars(__("Nickname"))?></label>
+							<input class="form-control" type="tel" id="nickname" name="nickname" placeholder="<?=htmlspecialchars(__("Type nickname"))?>" value="<?=htmlspecialchars($model->nickname)?>" />
+						</div>
 					</div>
 					</div>
-				</div>
+					<?php
+				}
+				?>
 			</div>
 			</div>
 
 
 			<div class="mb-3">
 			<div class="mb-3">

+ 3 - 6
views/suppliers.php

@@ -34,10 +34,9 @@ else {
 	<table class="table table-bordered table-hover mb-3">
 	<table class="table table-bordered table-hover mb-3">
 		<colgroup>
 		<colgroup>
 			<col style="width: 1%"/>
 			<col style="width: 1%"/>
-			<col style="width: 25%"/>
-			<col style="width: 25%"/>
-			<col style="width: 25%"/>
-			<col style="width: 25%"/>
+			<col style="width: 33%"/>
+			<col style="width: 33%"/>
+			<col style="width: 33%"/>
 			<col style="width: 1%"/>
 			<col style="width: 1%"/>
 		</colgroup>
 		</colgroup>
 		<thead>
 		<thead>
@@ -45,7 +44,6 @@ else {
 			<th><?=htmlspecialchars(__("ID"))?></th>
 			<th><?=htmlspecialchars(__("ID"))?></th>
 			<th><?=htmlspecialchars(__("Name"))?></th>
 			<th><?=htmlspecialchars(__("Name"))?></th>
 			<th><?=htmlspecialchars(__("Phone"))?></th>
 			<th><?=htmlspecialchars(__("Phone"))?></th>
-			<th><?=htmlspecialchars(__("Fax"))?></th>
 			<th><?=htmlspecialchars(__("Email"))?></th>
 			<th><?=htmlspecialchars(__("Email"))?></th>
 			<th><?=htmlspecialchars(__("Actions"))?></th>
 			<th><?=htmlspecialchars(__("Actions"))?></th>
 		</tr>
 		</tr>
@@ -60,7 +58,6 @@ else {
 					<?=htmlspecialchars($supplier->name)?>
 					<?=htmlspecialchars($supplier->name)?>
 				</td>
 				</td>
 				<td><?=htmlspecialchars($supplier->phone)?></td>
 				<td><?=htmlspecialchars($supplier->phone)?></td>
-				<td><?=htmlspecialchars($supplier->fax)?></td>
 				<td><?=htmlspecialchars($supplier->email)?></td>
 				<td><?=htmlspecialchars($supplier->email)?></td>
 				<td class="p-1 text-nowrap">
 				<td class="p-1 text-nowrap">
 					<a class="btn btn-sm btn-primary" href="<?=htmlspecialchars($supplier->getUrl())?>">
 					<a class="btn btn-sm btn-primary" href="<?=htmlspecialchars($supplier->getUrl())?>">