Skip to content

Commit

Permalink
Add info to purchase order
Browse files Browse the repository at this point in the history
  • Loading branch information
mbayopanda committed Oct 4, 2022
1 parent c7014bf commit 9315413
Show file tree
Hide file tree
Showing 19 changed files with 429 additions and 115 deletions.
1 change: 1 addition & 0 deletions client/src/i18n/en/entity.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"ASSIGNED_TO": "Assigned to",
"EDIT_ENTITY":"Edit Contact",
"NAME":"Name",
"TITLE":"Title",
"SEX":"Sex",
"PHONE":"Phone",
"EMAIL":"Email",
Expand Down
1 change: 1 addition & 0 deletions client/src/i18n/fr/entity.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"ASSIGNED_TO": "Attribué à",
"EDIT_ENTITY":"Modifier le contact",
"NAME":"Nom",
"TITLE":"Titre",
"SEX":"Sex",
"PHONE":"Téléphone",
"EMAIL":"Email",
Expand Down
19 changes: 19 additions & 0 deletions client/src/i18n/fr/purchases.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,25 @@
"RECEIVED_DESC" : "La commande a été reçu et se trouve dans le stock",
"WAITING_CONFIRMATION" : "En Attente de confirmation",
"WAITING_CONFIRMATION_DESC" : "Le fournisseur n'a pas encore confirmé qu'il saura fournir la commande"
},
"INFO" : {
"PURCHASE_NUMBER" : "Numero commande",
"PRF_NUMBER" : "Numero PRF",
"CONTACT_NAME" : "Personne de contact",
"CONTACT_PHONE" : "Téléphone du contact",
"CONTACT_TITLE" : "Titre du contact",
"DELIVERY_LOCATION" : "Lieu de livraison",
"DELIVERY_DATE" : "Date de livraison",
"DELIVERY_CONDITION" : "Condition de livraison",
"PAYMENT_CONDITION" : "Condition de paiement",
"SPECIAL_INSTRUCTION" : "Instruction speciale",
"REQUESTED_BY": "Demandé par (nom en caractères d'imprimerie)",
"APPROVED_BY": "Approuvé par (nom en caractères d'imprimerie)",
"APPROVED_TWO_BY": "Deuxième approbation (nom en caractères d'imprimerie)",
"SIGNATURE": "Signature",
"DATE": "Date",
"TITLE": "Titre",
"SUPPLIER_OBLIGATION": "Le fournisseur est tenu de signer et de renvoyer une copie de ce bon de commande :"
}
}
}
1 change: 1 addition & 0 deletions client/src/js/components/bhInputText.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ angular.module('bhima.components')
key : '@?',
description : '@?',
isCurrency : '<?',
disabled : '<?',
},
});

Expand Down
5 changes: 5 additions & 0 deletions client/src/modules/entities/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ function EntityController(
displayName : 'ENTITY.NAME',
headerCellFilter : 'translate',
},
{
field : 'title',
displayName : 'ENTITY.TITLE',
headerCellFilter : 'translate',
},
{
field : 'phone',
displayName : 'ENTITY.PHONE',
Expand Down
2 changes: 1 addition & 1 deletion client/src/modules/entities/entities.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function EntityService(Api, util) {
const service = new Api(baseUrl);
service.types = new Api(baseUrl.concat('types/'));

const entityKeys = ['uuid', 'display_name', 'gender', 'email', 'phone', 'address', 'entity_type_id'];
const entityKeys = ['uuid', 'display_name', 'title', 'gender', 'email', 'phone', 'address', 'entity_type_id'];
service.clean = entity => util.maskObjectFromKeys(entity, entityKeys);

return service;
Expand Down
6 changes: 6 additions & 0 deletions client/src/modules/entities/modals/entity.modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
</div>
</div>

<!-- title -->
<div class="form-group">
<label class="control-label" translate>ENTITY.TITLE</label>
<input name="title" ng-model="EntityModalCtrl.entity.title" autocomplete="off" class="form-control">
</div>

<!-- entity type -->
<bh-entity-type-select
id="EntityModalCtrl.entity.entity_type_id"
Expand Down
15 changes: 14 additions & 1 deletion client/src/modules/purchases/create/PurchaseOrderForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@ function PurchaseOrderFormService(Inventory, AppCache, Store, Pool, PurchaseOrde
this.details.note = order.note;
this.details.supplier_uuid = order.supplier_uuid;

this.details.info_purchase_number = order.info_purchase_number;
this.details.info_prf_number = order.info_prf_number;
this.details.info_contact_name = order.info_contact_name;
this.details.info_contact_phone = order.info_contact_phone;
this.details.info_contact_title = order.info_contact_title;
this.details.info_delivery_location = order.info_delivery_location;
this.details.info_delivery_date = order.info_delivery_date;
this.details.info_delivery_condition = order.info_delivery_condition;
this.details.info_special_instruction = order.info_special_instruction;
this.details.info_payment_condition = order.info_payment_condition;

// TODO(@jniles) - what do we do about user_id? Should we
// modify it? Keep a table of modifications to purchase orders?
// NOTE(@jniles) - Vanga would like to see who modified the purchase orders.
Expand Down Expand Up @@ -191,9 +202,11 @@ function PurchaseOrderFormService(Inventory, AppCache, Store, Pool, PurchaseOrde
*/
PurchaseOrderForm.prototype.setSupplier = function setSupplier(supplier) {
const order = this;

// attach the creditor uuid to the request
order.details.supplier_uuid = supplier.uuid;
order.details.info_contact_name = supplier.contact_name;
order.details.info_contact_title = supplier.contact_title;
order.details.info_contact_phone = supplier.contact_phone;

// add a single item to the order to begin
if (order.store.data.length === 0) {
Expand Down
202 changes: 142 additions & 60 deletions client/src/modules/purchases/create/createUpdate.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div class="flex-header">
<div class="bhima-title">
<ol class="headercrumb">
<li class="static" translate>TREE.INVENTORY</li>
<li class="title" translate>PURCHASES.PAGE_TITLE</li>
<li class="static" translate>PURCHASES.PAGE_TITLE</li>
<li class="title" translate>TREE.PURCHASE</li>
</ol>
</div>
</div>
Expand All @@ -22,59 +22,52 @@
<div class="col-xs-12">
<div class="panel panel-default">
<div class="panel-body">
<div class="col-md-6">
<div class="col-md-4">
<bh-supplier-select
supplier-uuid="PurchaseCtrl.order.details.supplier_uuid"
on-select-callback="PurchaseCtrl.order.setSupplier(supplier)">
</bh-supplier-select>

<bh-date-editor
date-value="PurchaseCtrl.order.details.date"
on-change="PurchaseCtrl.order.onDateChange(date)">
</bh-date-editor>
<bh-input-text
key="info_contact_name"
text-value="PurchaseCtrl.order.details.info_contact_name"
label="PURCHASES.INFO.CONTACT_NAME">
</bh-input-text>

<div class="form-group">
<label class="control-label">
<span translate>FORM.LABELS.PAYMENT_METHOD</span>
<span
class="text-info fa fa-info-circle"
uib-popover-template="'typePopover.tmpl.html'"
popover-placement="right"
popover-append-to-body="true"
popover-trigger="mouseenter">
</span>
</label>
<bh-input-text
key="info_contact_title"
text-value="PurchaseCtrl.order.details.info_contact_title"
label="PURCHASES.INFO.CONTACT_TITLE">
</bh-input-text>

<div class="radio" style="margin-top:0;">
<label>
<input type="radio" name="paymentMethod" id="on-purchase" value="FORM.LABELS.ON_PURCHASE" ng-model="PurchaseCtrl.order.details.payment_method" required>
<span translate>FORM.LABELS.ON_PURCHASE</span>
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="paymentMethod" id="on-delivery" value="FORM.LABELS.ON_DELIVERY" ng-model="PurchaseCtrl.order.details.payment_method" required>
<span translate>FORM.LABELS.ON_DELIVERY</span>
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="paymentMethod" id="other" value="FORM.LABELS.OTHER" ng-model="PurchaseCtrl.order.details.payment_method" required>
<span translate>FORM.LABELS.OTHER</span>
</label>
</div>
<bh-input-text
key="info_contact_phone"
text-value="PurchaseCtrl.order.details.info_contact_phone"
label="PURCHASES.INFO.CONTACT_PHONE">
</bh-input-text>

<div class="help-block" ng-messages="PurchaseOrderForm.paymentMethod.$error" ng-show="PurchaseOrderForm.$submitted">
<div ng-messages-include="modules/templates/messages.tmpl.html"></div>
</div>
</div>
<hr>

<bh-input-text
key="info_purchase_number"
text-value="PurchaseCtrl.order.details.info_purchase_number"
label="PURCHASES.INFO.PURCHASE_NUMBER">
</bh-input-text>
<bh-input-text
key="info_prf_number"
text-value="PurchaseCtrl.order.details.info_prf_number"
label="PURCHASES.INFO.PRF_NUMBER">
</bh-input-text>

</div>
<div class="col-md-4">
<bh-date-editor
date-value="PurchaseCtrl.order.details.date"
on-change="PurchaseCtrl.order.onDateChange(date)">
</bh-date-editor>

<div class="col-md-6">
<div
class="form-group"
style="margin-bottom: 0.5em"
ng-show="PurchaseCtrl.hasMultipleCurrencies"
ng-class="{ 'has-error' : PurchaseCtrl.$submitted && PurchaseCtrl.currency.$invalid }">
<label class="control-label" translate>FORM.LABELS.CURRENCY</label>
Expand Down Expand Up @@ -107,24 +100,6 @@
<i>{{ PurchaseCtrl.currentExchangeRate | currency:PurchaseCtrl.rate.currency.id }}</i>
<i><span translate>FORM.INFO.PER</span> {{PurchaseCtrl.enterprise.currencySymbol}}</i>
</div>

<div
class="form-group"
ng-class="{'has-error' : PurchaseOrderForm.$submitted && PurchaseOrderForm.notes.$invalid }">
<label class="control-label" translate>FORM.LABELS.NOTES </label>
<textarea
ng-model="PurchaseCtrl.order.details.note"
name="notes"
class="form-control"
rows="5"
ng-maxlength="PurchaseCtrl.maxLength"
required>
</textarea>
<div class="help-block" ng-messages="PurchaseOrderForm.notes.$error" ng-show="PurchaseOrderForm.$submitted">
<div ng-messages-include="modules/templates/messages.tmpl.html"></div>
</div>
</div>

<div
class="form-group"
ng-class="{'has-error' : PurchaseOrderForm.$submitted && PurchaseOrderForm.shipping_handling.$invalid }">
Expand All @@ -142,12 +117,119 @@
</div>
</div>

<div class="form-group">
<label class="control-label">
<span translate>FORM.LABELS.PAYMENT_METHOD</span>
<span
class="text-info fa fa-info-circle"
uib-popover-template="'typePopover.tmpl.html'"
popover-placement="right"
popover-append-to-body="true"
popover-trigger="mouseenter">
</span>
</label>

<div class="radio" style="margin-top:0;">
<label>
<input type="radio" name="paymentMethod" id="on-purchase" value="FORM.LABELS.ON_PURCHASE" ng-model="PurchaseCtrl.order.details.payment_method" required>
<span translate>FORM.LABELS.ON_PURCHASE</span>
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="paymentMethod" id="on-delivery" value="FORM.LABELS.ON_DELIVERY" ng-model="PurchaseCtrl.order.details.payment_method" required>
<span translate>FORM.LABELS.ON_DELIVERY</span>
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="paymentMethod" id="other" value="FORM.LABELS.OTHER" ng-model="PurchaseCtrl.order.details.payment_method" required>
<span translate>FORM.LABELS.OTHER</span>
</label>
</div>

<div class="help-block" ng-messages="PurchaseOrderForm.paymentMethod.$error" ng-show="PurchaseOrderForm.$submitted">
<div ng-messages-include="modules/templates/messages.tmpl.html"></div>
</div>
</div>

<div
class="form-group">
<label class="control-label" translate>PURCHASES.INFO.PAYMENT_CONDITION</label>
<textarea
ng-model="PurchaseCtrl.order.details.info_payment_condition"
name="info_payment_condition"
class="form-control"
rows="3"
ng-maxlength="PurchaseCtrl.maxLength">
</textarea>
</div>
</div>
<div class="col-md-4">

<bh-input-text
key="info_delivery_date"
text-value="PurchaseCtrl.order.details.info_delivery_date"
label="PURCHASES.INFO.DELIVERY_DATE">
</bh-input-text>

<bh-input-text
key="info_delivery_location"
text-value="PurchaseCtrl.order.details.info_delivery_location"
label="PURCHASES.INFO.DELIVERY_LOCATION">
</bh-input-text>

<div
class="form-group">
<label class="control-label" translate>PURCHASES.INFO.DELIVERY_CONDITION</label>
<textarea
ng-model="PurchaseCtrl.order.details.info_delivery_condition"
name="info_delivery_condition"
class="form-control"
rows="3"
ng-maxlength="PurchaseCtrl.maxLength">
</textarea>
</div>
</div>
</div>
</div>
</div>
</div>

<div class="row">
<div class="col-md-6">
<div
class="form-group"
ng-class="{'has-error' : PurchaseOrderForm.$submitted && PurchaseOrderForm.notes.$invalid }">
<label class="control-label" translate>FORM.LABELS.NOTES </label>
<textarea
ng-model="PurchaseCtrl.order.details.note"
name="notes"
class="form-control"
rows="2"
ng-maxlength="PurchaseCtrl.maxLength"
required>
</textarea>
<div class="help-block" ng-messages="PurchaseOrderForm.notes.$error" ng-show="PurchaseOrderForm.$submitted">
<div ng-messages-include="modules/templates/messages.tmpl.html"></div>
</div>
</div>
</div>
<div class="col-md-6">
<div
class="form-group">
<label class="control-label" translate>PURCHASES.INFO.SPECIAL_INSTRUCTION</label>
<textarea
ng-model="PurchaseCtrl.order.details.info_special_instruction"
name="info_special_instruction"
class="form-control"
rows="2"
ng-maxlength="PurchaseCtrl.maxLength">
</textarea>
</div>
</div>
</div>

<div class="row" ng-if="PurchaseCtrl.order._hasGlobalError">
<div class="col-xs-12">
<div class="alert alert-danger">
Expand Down
Loading

0 comments on commit 9315413

Please sign in to comment.